Ignore:
Timestamp:
Jun 20, 2016 10:10:42 AM (3 years ago)
Author:
nanang
Message:

Close #1927: IPv6 support in DNS SRV:

  • support DNS A and AAAA resolution for each target in DNS SRV record
  • support fallback to DNS A and DNS AAAA resolution when DNS SRV record is not available
  • support IPv6 nameservers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/include/pjlib-util/resolver.h

    r3553 r5349  
    224224 
    225225} pj_dns_a_record; 
     226 
     227 
     228/** 
     229 * This structure represents DNS address record, i.e: DNS A and DNS AAAA 
     230 * records, as the result of parsing DNS response packet using 
     231 * #pj_dns_parse_addr_response(). 
     232 */ 
     233typedef struct pj_dns_addr_record 
     234{ 
     235    /** The target name being queried.   */ 
     236    pj_str_t            name; 
     237 
     238    /** If target name corresponds to a CNAME entry, the alias contains 
     239     *  the value of the CNAME entry, otherwise it will be empty. 
     240     */ 
     241    pj_str_t            alias; 
     242 
     243    /** Number of IP addresses. */ 
     244    unsigned            addr_count; 
     245 
     246    /** IP addresses of the host found in the response */ 
     247    struct { 
     248 
     249        /** IP address family */ 
     250        int             af; 
     251         
     252        /** IP address */ 
     253        union { 
     254            /** IPv4 address */ 
     255            pj_in_addr  v4; 
     256 
     257            /** IPv6 address */ 
     258            pj_in6_addr v6; 
     259        } ip; 
     260 
     261    } addr[PJ_DNS_MAX_IP_IN_A_REC]; 
     262 
     263    /** Internal buffer for hostname and alias. */ 
     264    char                buf_[128]; 
     265 
     266} pj_dns_addr_record; 
    226267 
    227268 
     
    409450 
    410451/** 
     452 * A utility function to parse a DNS response containing AAAA records into  
     453 * DNS AAAA record. 
     454 * 
     455 * @param pkt       The DNS response packet. 
     456 * @param rec       The structure to be initialized with the parsed 
     457 *                  DNS AAAA record from the packet. 
     458 * 
     459 * @return          PJ_SUCCESS if response can be parsed successfully. 
     460 */ 
     461PJ_DECL(pj_status_t) pj_dns_parse_addr_response( 
     462                                            const pj_dns_parsed_packet *pkt, 
     463                                            pj_dns_addr_record *rec); 
     464 
     465 
     466/** 
    411467 * Put the specified DNS packet into DNS cache. This function is mainly used 
    412468 * for testing the resolver, however it can also be used to inject entries 
Note: See TracChangeset for help on using the changeset viewer.