Ignore:
Timestamp:
Apr 8, 2015 10:10:44 AM (5 years ago)
Author:
riza
Message:

Re #1838: Enable application to provide its own external resolver implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_resolve.c

    r4954 r5055  
    7171{ 
    7272    pj_dns_resolver *res; 
     73    pjsip_ext_resolver *ext_res; 
    7374}; 
    7475 
     
    115116} 
    116117 
     118/* 
     119 * Public API to set the DNS external resolver implementation for the SIP  
     120 * resolver. 
     121 */ 
     122PJ_DEF(pj_status_t) pjsip_resolver_set_ext_resolver(pjsip_resolver_t *res, 
     123                                                    pjsip_ext_resolver *ext_res) 
     124{ 
     125    if (ext_res && !ext_res->resolve) 
     126        return PJ_EINVAL; 
     127 
     128    if (ext_res && res->res) { 
     129#if PJSIP_HAS_RESOLVER 
     130        pj_dns_resolver_destroy(res->res, PJ_FALSE); 
     131#endif 
     132        res->res = NULL; 
     133    } 
     134    res->ext_res = ext_res; 
     135    return PJ_SUCCESS; 
     136} 
     137 
    117138 
    118139/* 
     
    175196    struct query *query; 
    176197    pjsip_transport_type_e type = target->type; 
     198 
     199    /* If an external implementation has been provided use it instead */ 
     200    if (resolver->ext_res) { 
     201        (*resolver->ext_res->resolve)(resolver, pool, target, token, cb); 
     202        return; 
     203    } 
    177204 
    178205    /* Is it IP address or hostname? And if it's an IP, which version? */ 
Note: See TracChangeset for help on using the changeset viewer.