Commit 7f8c7811 authored by Simon Morlat's avatar Simon Morlat

Add belle_sip_http_get test program to compilation. Add a --no-srv option to...

Add belle_sip_http_get test program to compilation. Add a --no-srv option to resolver test, to check resolution without SRV queries.
parent e7668f38
......@@ -150,6 +150,16 @@ else()
set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_link_libraries(belle_sip_parse ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
set(GET_SOURCES get.c)
bc_apply_compile_flags(GET_SOURCES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(belle_sip_http_get ${USE_BUNDLE} ${GET_SOURCES})
set_target_properties(belle_sip_http_get PROPERTIES LINKER_LANGUAGE CXX)
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_http_get PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
target_link_libraries(belle_sip_http_get ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
endif()
......
......@@ -19,10 +19,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include "belle-sip/belle-sip.h"
......
......@@ -44,20 +44,28 @@ int main(int argc, char *argv[]){
int i;
const char *domain=NULL;
const char *transport="udp";
int use_srv = 1;
if (argc<2){
fprintf(stderr,"Usage:\n%s <domain name> [transport] [--debug]\n",argv[0]);
fprintf(stderr,"Usage:\n%s <domain name> [transport] [--no-srv] [--debug]\n",argv[0]);
return -1;
}
domain=argv[1];
for (i=2;i<argc;i++){
if (strcmp(argv[i],"--debug")==0){
belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG);
}else if (strcmp(argv[i],"--no-srv")==0){
use_srv = 0;
}else if (strstr(argv[i],"--")!=argv[i]) transport=argv[i];
}
stack=belle_sip_stack_new(NULL);
printf("Trying to resolve domain '%s', with transport hint '%s'\n",domain,transport);
belle_sip_stack_resolve(stack,"sip", transport,domain,5060,AF_INET6,resolver_callback,NULL);
if (use_srv){
printf("Trying to resolve domain '%s', with transport hint '%s'\n",domain,transport);
belle_sip_stack_resolve(stack,"sip", transport,domain,5060,AF_INET6,resolver_callback,NULL);
}else{
printf("Trying to resolve domain '%s' without SRV...\n",domain);
belle_sip_stack_resolve_a(stack, domain, 5060, AF_INET6, resolver_callback, NULL);
}
belle_sip_stack_main(stack);
belle_sip_object_unref(stack);
return 0;
......
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