| 1652 | |
| 1653 | #if 0 |
| 1654 | struct hostent* sip_resolvehost(str* name, unsigned short* port, int *proto, |
| 1655 | int is_sips) |
| 1656 | { |
| 1657 | static char tmp[MAX_DNS_NAME]; |
| 1658 | struct ip_addr *ip; |
| 1659 | struct rdata *head; |
| 1660 | struct rdata *rd; |
| 1661 | struct hostent* he; |
| 1662 | |
| 1663 | if ( (is_sips) |
| 1664 | && (tls_disable) |
| 1665 | ) { |
| 1666 | LM_ERR("cannot resolve SIPS as no TLS support is configured\n"); |
| 1667 | return 0; |
| 1668 | } |
| 1669 | |
| 1670 | /* check if it's an ip address */ |
| 1671 | if ( ((ip=str2ip(name))!=0) |
| 1672 | || ((ip=str2ip6(name))!=0) |
| 1673 | ){ |
| 1674 | /* we are lucky, this is an ip address */ |
| 1675 | if (proto && *proto==PROTO_NONE) |
| 1676 | *proto = (is_sips)?PROTO_TLS:PROTO_UDP; |
| 1677 | if (port && *port==0) |
| 1678 | *port = (is_sips||((*proto)==PROTO_TLS))?SIPS_PORT:SIP_PORT; |
| 1679 | return ip_addr2he(name,ip); |
| 1680 | } |
| 1681 | |
| 1682 | /* do we have a port? */ |
| 1683 | if ( !port || (*port)!=0 ) { |
| 1684 | /* have port -> no NAPTR, no SRV lookup, just A record lookup */ |
| 1685 | LM_DBG("has port -> do A record lookup!\n"); |
| 1686 | /* set default PROTO if not set */ |
| 1687 | if (proto && *proto==PROTO_NONE) |
| 1688 | *proto = (is_sips)?PROTO_TLS:PROTO_UDP; |
| 1689 | goto do_a; |
| 1690 | } |
| 1691 | |
| 1692 | /* no port... what about proto? */ |
| 1693 | if ( !proto || (*proto)!=PROTO_NONE ) { |
| 1694 | /* have proto, but no port -> do SRV lookup */ |
| 1695 | LM_DBG("no port, has proto -> do SRV lookup!\n"); |
| 1696 | if (is_sips && (*proto)!=PROTO_TLS) { |
| 1697 | LM_ERR("forced proto %d not matching sips uri\n", *proto); |
| 1698 | return 0; |
| 1699 | } |
| 1700 | goto do_srv; |
| 1701 | } |
| 1702 | |
| 1703 | LM_DBG("no port, no proto -> do NAPTR lookup!\n"); |
| 1704 | /* no proto, no port -> do NAPTR lookup */ |
| 1705 | if (name->len >= MAX_DNS_NAME) { |
| 1706 | LM_ERR("domain name too long\n"); |
| 1707 | return 0; |
| 1708 | } |
| 1709 | memcpy(tmp, name->s, name->len); |
| 1710 | tmp[name->len] = '\0'; |
| 1711 | /* do NAPTR lookup */ |
no test coverage detected