Commit 0b074bd6 authored by jehan's avatar jehan

add option --dns-hosts to belle sip tester for suite http & register

parent a33fb9dc
......@@ -78,6 +78,9 @@ static belle_http_provider_t *prov=NULL;
static int http_before_all(void) {
stack=belle_sip_stack_new(NULL);
if (userhostsfile)
belle_sip_stack_set_dns_user_hosts_file(stack,userhostsfile);
prov=belle_sip_stack_create_http_provider(stack,"0.0.0.0");
if (belle_sip_tester_get_root_ca_path() != NULL) {
belle_tls_crypto_config_t *crypto_config=belle_tls_crypto_config_new();
......
......@@ -240,6 +240,9 @@ static void process_auth_requested(void *user_ctx, belle_sip_auth_event_t *event
int register_before_all(void) {
belle_sip_listening_point_t *lp;
stack=belle_sip_stack_new(NULL);
if (userhostsfile)
belle_sip_stack_set_dns_user_hosts_file(stack,userhostsfile);
lp=belle_sip_stack_create_listening_point(stack,"0.0.0.0",7060,"UDP");
prov=belle_sip_stack_create_provider(stack,lp);
......
......@@ -35,6 +35,7 @@ static FILE * log_file = NULL;
static belle_sip_object_pool_t *pool;
static int leaked_objects_count;
const char *userhostsfile = NULL;
static int _belle_sip_tester_ipv6_available(void){
struct addrinfo *ai=bctbx_ip_address_to_addrinfo(AF_INET6,SOCK_STREAM,"2a01:e00::2",53);
......@@ -187,7 +188,8 @@ static const char* belle_sip_helper =
"\t\t\t--log-file <output log file path>\n"
"\t\t\t--domain <test sip domain>\n"
"\t\t\t--auth-domain <test auth domain>\n"
"\t\t\t--root-ca <root ca file path>\n";
"\t\t\t--root-ca <root ca file path>\n"
"\t\t\t--dns-hosts </etc/hosts -like file to used to override DNS names (default: tester_hosts)>\n";
int main (int argc, char *argv[]) {
int i;
......@@ -233,6 +235,9 @@ int main (int argc, char *argv[]) {
} else if (strcmp(argv[i], "--root-ca") == 0) {
CHECK_ARG("--root-ca", ++i, argc);
root_ca_path = argv[i];
}else if (strcmp(argv[i],"--dns-hosts")==0){
CHECK_ARG("--dns-hosts", ++i, argc);
userhostsfile=argv[i];
}else {
int ret = bc_tester_parse_args(argc, argv, i);
if (ret>0) {
......
......@@ -58,6 +58,7 @@ void belle_sip_tester_uninit(void);
void belle_sip_tester_before_each(void);
void belle_sip_tester_after_each(void);
int belle_sip_tester_set_log_file(const char *filename);
extern const char *userhostsfile;
#ifdef __cplusplus
};
......
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