Ignore:
Timestamp:
Jun 11, 2007 4:47:51 PM (17 years ago)
Author:
bennylp
Message:

Ticket #329: Added utility function to parse DNS A response in PJLIB-UTIL

File:
1 edited

Legend:

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

    r1346 r1356  
    197197    unsigned    bad_ns_ttl;     /**< See #PJ_DNS_RESOLVER_BAD_NS_TTL        */ 
    198198} pj_dns_settings; 
     199 
     200 
     201/** 
     202 * This structure represents DNS A record, as the result of parsing 
     203 * DNS response packet using #pj_dns_parse_a_response(). 
     204 */ 
     205typedef struct pj_dns_a_record 
     206{ 
     207    /** The target name being queried.   */ 
     208    pj_str_t            name; 
     209 
     210    /** If target name corresponds to a CNAME entry, the alias contains 
     211     *  the value of the CNAME entry, otherwise it will be empty. 
     212     */ 
     213    pj_str_t            alias; 
     214 
     215    /** Number of IP addresses. */ 
     216    unsigned            addr_count; 
     217 
     218    /** IP addresses of the host found in the response */ 
     219    pj_in_addr          addr[PJ_DNS_MAX_IP_IN_A_REC]; 
     220 
     221    /** Internal buffer for hostname and alias. */ 
     222    char                buf_[128]; 
     223 
     224} pj_dns_a_record; 
     225 
    199226 
    200227/** 
     
    366393                                                  pj_bool_t notify); 
    367394 
     395/** 
     396 * A utility function to parse a DNS response containing A records into  
     397 * DNS A record. 
     398 * 
     399 * @param pkt       The DNS response packet. 
     400 * @param rec       The structure to be initialized with the parsed 
     401 *                  DNS A record from the packet. 
     402 * 
     403 * @return          PJ_SUCCESS if response can be parsed successfully. 
     404 */ 
     405PJ_DECL(pj_status_t) pj_dns_parse_a_response(const pj_dns_parsed_packet *pkt, 
     406                                             pj_dns_a_record *rec); 
     407 
    368408 
    369409/** 
Note: See TracChangeset for help on using the changeset viewer.