int tlsp_add_cli_domain(modparam_t type, void *val) { struct ip_addr *ip; unsigned int port; str domain; str id; if (parse_domain_def( (char*)val, &id, &ip, &port, &domain)<0 ) return -1; /* add domain */ if (ip==NULL) { if (tls_new_client_domain_name( &id, &domain)<0) { LM_ERR("failed to add new client domain name [%s]\n",(char*)val); return -1; } } else { if (tls_new_client_domain( &id, ip, port )<0) { LM_ERR("failed to add new client domain [%s]\n",(char*)val); return -1; } } return 1; }
int tlsp_add_cli_domain(modparam_t type, void *val) { struct ip_addr *ip = NULL; unsigned int port = 0; str name, dom_str; init_str(&dom_str, val); if (parse_domain_def(&dom_str, &name, &ip, &port) < 0) return -1; if (tls_client_domains == NULL) { tls_client_domains = shm_malloc(sizeof *tls_client_domains); if (!tls_client_domains) { LM_ERR("No more shm mem\n"); return -1; } *tls_client_domains = NULL; } if (tls_find_domain_by_name(&name, tls_client_domains)) { LM_ERR("Domain name: [%.*s] already defined\n", name.len, name.s); return -1; } /* add domain */ if (tls_new_client_domain(&name, ip, port, tls_client_domains) < 0) { LM_ERR("failed to add new client domain [%.*s]\n", name.len, name.s); return -1; } return 1; }
int tlsp_add_srv_domain(modparam_t type, void *val) { struct ip_addr *ip; unsigned int port; str domain; str id; if (parse_domain_def( (char*)val, &id, &ip, &port, &domain)<0 ) return -1; if (ip==NULL) { LM_ERR("server domains do not support 'domain name' in definition\n"); return -1; } /* add domain */ if (tls_new_server_domain( &id, ip, port )<0) { LM_ERR("failed to add new server domain [%s]\n",(char*)val); return -1; } return 1; }