Commit f46c1b1b authored by johan's avatar johan
Browse files

Merge remote-tracking branch 'origin' into bctoolbox

parents e5d1d8ad f76447b4
......@@ -207,10 +207,11 @@ if(WIN32)
-DBELLESIP_INTERNAL_EXPORTS
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_definitions(
-DHAVE_COMPILER_TLS
-DUSE_FIXED_NAMESERVERS
-DUSE_GETADDRINFO_FALLBACK
)
endif()
......
......@@ -1028,7 +1028,7 @@ static const char *get_sip_uri_header_noescapes(void) {
static char* belle_sip_escape(const char* buff, const char *noescapes) {
size_t outbuf_size=strlen(buff);
size_t orig_size=outbuf_size;
char *output_buff=(char*)belle_sip_malloc(outbuf_size+1);
char *output_buff=(char*)belle_sip_malloc(outbuf_size + 1);
int i;
size_t out_buff_index=0;
......@@ -1036,14 +1036,14 @@ static char* belle_sip_escape(const char* buff, const char *noescapes) {
int c = ((unsigned char*)buff)[i];
if (outbuf_size < out_buff_index + 3){
// we will possibly add 3 chars
outbuf_size+=MAX(orig_size/2,3);
output_buff=belle_sip_realloc(output_buff,outbuf_size+1);
outbuf_size += MAX(orig_size/2,3);
output_buff = belle_sip_realloc(output_buff, outbuf_size + 1);
}
if (noescapes[c] == 1) {
output_buff[out_buff_index++]=c;
} else {
// this will write 3 characters
out_buff_index+=snprintf(output_buff+out_buff_index,outbuf_size-out_buff_index,"%%%02x", c);
out_buff_index+=snprintf(output_buff+out_buff_index, outbuf_size +1 - out_buff_index, "%%%02x", c);
}
}
output_buff[out_buff_index]='\0';
......
......@@ -94,6 +94,7 @@ static void on_channel_state_changed(belle_sip_channel_listener_t *l, belle_sip_
break;
case BELLE_SIP_CHANNEL_DISCONNECTED:
case BELLE_SIP_CHANNEL_ERROR:
belle_sip_object_ref(t); /*take a ref in the case where the app calls belle_sip_transaction_terminate() within the listener*/
ev.transport=belle_sip_channel_get_transport_name(chan);
ev.source=BELLE_SIP_OBJECT(t);
ev.port=chan->peer_port;
......@@ -108,6 +109,7 @@ static void on_channel_state_changed(belle_sip_channel_listener_t *l, belle_sip_
notify_timeout((belle_sip_transaction_t*)t);
belle_sip_transaction_terminate(t);
belle_sip_object_unref(t);
break;
default:
/*ignored*/
......@@ -190,8 +192,7 @@ void belle_sip_transaction_notify_timeout(belle_sip_transaction_t *t){
* Otherwise it will report the error.
* We limit this dead channel reporting to REGISTER transactions, who are unlikely to be unresponded.
**/
belle_sip_object_ref(t); /*take a ref in the case where the app calls belle_sip_transaction_terminate() within the timeout listener*/
if (strcmp(belle_sip_request_get_method(t->request),"REGISTER")==0){
if ( belle_sip_channel_notify_timeout(t->channel)==TRUE){
belle_sip_warning("Transaction [%p] reporting timeout, reporting to channel.",t);
......@@ -201,6 +202,7 @@ void belle_sip_transaction_notify_timeout(belle_sip_transaction_t *t){
notify_timeout(t);
belle_sip_transaction_terminate(t);
}
belle_sip_object_unref(t);
}
belle_sip_dialog_t* belle_sip_transaction_get_dialog(const belle_sip_transaction_t *t) {
......
......@@ -44,32 +44,59 @@ set(TESTER_SOURCES
add_definitions(-DBC_CONFIG_FILE="config.h")
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
apply_compile_flags(TESTER_SOURCES "CPP" "C")
add_executable(belle_sip_tester ${TESTER_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_include_directories(belle_sip_tester PUBLIC ${CUNIT_INCLUDE_DIR} PRIVATE common)
target_link_libraries(belle_sip_tester ${CUNIT_LIBRARIES} bellesip)
add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(OBJECT_DESCRIBE_SOURCES describe.c)
add_library(belle_sip_tester_static STATIC ${TESTER_SOURCES})
target_include_directories(belle_sip_tester_static PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
target_link_libraries(belle_sip_tester_static ${CUNIT_LIBRARIES} bellesip)
set(RUNTIME_COMPONENT_SOURCES
belle_sip_tester_windows.cpp
belle_sip_tester_windows.h
)
add_library(belle_sip_tester_runtime MODULE ${RUNTIME_COMPONENT_SOURCES})
target_include_directories(belle_sip_tester_runtime PRIVATE common)
target_link_libraries(belle_sip_tester_runtime belle_sip_tester_static)
set_target_properties(belle_sip_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE)
install(TARGETS belle_sip_tester_runtime
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/belle_sip_tester_runtime.winmd" DESTINATION bin)
else()
add_executable(belle_sip_tester ${TESTER_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_include_directories(belle_sip_tester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
target_link_libraries(belle_sip_tester ${CUNIT_LIBRARIES} bellesip)
add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
set(OBJECT_DESCRIBE_SOURCES describe.c)
apply_compile_flags(OBJECT_DESCRIBE_SOURCES "CPP" "C")
add_executable(belle_sip_object_describe ${OBJECT_DESCRIBE_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_link_libraries(belle_sip_object_describe bellesip)
apply_compile_flags(OBJECT_DESCRIBE_SOURCES "CPP" "C")
add_executable(belle_sip_object_describe ${OBJECT_DESCRIBE_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_link_libraries(belle_sip_object_describe bellesip)
set(PARSE_SOURCES parse.c)
set(PARSE_SOURCES parse.c)
apply_compile_flags(PARSE_SOURCES "CPP" "C")
add_executable(belle_sip_parse ${PARSE_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_link_libraries(belle_sip_parse bellesip)
apply_compile_flags(PARSE_SOURCES "CPP" "C")
add_executable(belle_sip_parse ${PARSE_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_link_libraries(belle_sip_parse bellesip)
......@@ -2,7 +2,7 @@
#include "belle_sip_tester_windows.h"
using namespace belle_sip_tester_runtime_component;
using namespace belle_sip_tester_runtime;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Storage;
......
......@@ -3,7 +3,7 @@
#include "belle-sip/belle-sip.h"
#include "belle_sip_tester.h"
namespace belle_sip_tester_runtime_component
namespace belle_sip_tester_runtime
{
public interface class OutputTraceListener
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment