diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-03-02 14:35:57 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-03-02 14:35:57 +0000 |
commit | c0ad24645c062d3ce27fc5c3e85b08cafe1d4ad1 (patch) | |
tree | 30c393db984530c9bd4963da5466db609e701f15 /pjlib-util/include | |
parent | 68446a09672bbb32172f7bebb0efb3a838a2d827 (diff) |
Fixed ticket #156: Not enough memory to parse DNS packets in resolver (thanks Frank Wiersma)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1031 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util/include')
-rw-r--r-- | pjlib-util/include/pjlib-util/config.h | 9 | ||||
-rw-r--r-- | pjlib-util/include/pjlib-util/dns.h | 20 |
2 files changed, 27 insertions, 2 deletions
diff --git a/pjlib-util/include/pjlib-util/config.h b/pjlib-util/include/pjlib-util/config.h index 612f4bc0..f33ad4a8 100644 --- a/pjlib-util/include/pjlib-util/config.h +++ b/pjlib-util/include/pjlib-util/config.h @@ -169,6 +169,15 @@ #endif +/** + * Size of temporary pool buffer for parsing DNS packets in resolver. + * + * default: 4000 + */ +#ifndef PJ_DNS_RESOLVER_TMP_BUF_SIZE +# define PJ_DNS_RESOLVER_TMP_BUF_SIZE 4000 +#endif + /* ************************************************************************** * SCANNER CONFIGURATION diff --git a/pjlib-util/include/pjlib-util/dns.h b/pjlib-util/include/pjlib-util/dns.h index cebc20f8..dcea621a 100644 --- a/pjlib-util/include/pjlib-util/dns.h +++ b/pjlib-util/include/pjlib-util/dns.h @@ -25,7 +25,7 @@ * @brief Low level DNS message parsing and packetization. */ #include <pjlib-util/types.h> - +#include <pj/sock.h> PJ_BEGIN_DECL @@ -258,7 +258,8 @@ typedef struct pj_dns_parsed_rr /** A Resource Data (PJ_DNS_TYPE_A, 1) */ struct a { - pj_str_t ip_addr;/**< IP host address string. */ + //pj_str_t ip_addr;/**< IP host address string. */ + pj_in_addr ip_addr; } a; } rdata; @@ -282,6 +283,19 @@ typedef struct pj_dns_parsed_packet /** + * Option flags to be specified when calling #pj_dns_packet_dup() function. + * These flags can be combined with bitwise OR operation. + */ +enum pj_dns_dup_options +{ + PJ_DNS_NO_QD = 1, /**< Do not duplicate the query section. */ + PJ_DNS_NO_ANS = 2, /**< Do not duplicate the answer section. */ + PJ_DNS_NO_NS = 4, /**< Do not duplicate the NS section. */ + PJ_DNS_NO_AR = 8 /**< Do not duplicate the additional rec section */ +}; + + +/** * Create DNS query packet to resolve the specified names. This function * can be used to build any types of DNS query, such as A record or DNS SRV * record. @@ -331,10 +345,12 @@ PJ_DECL(pj_status_t) pj_dns_parse_packet(pj_pool_t *pool, * * @param pool The pool to allocate memory for the duplicated packet. * @param p The DNS packet to be cloned. + * @param options Option flags, from pj_dns_dup_options. * @param p_dst Pointer to store the cloned DNS packet. */ PJ_DECL(void) pj_dns_packet_dup(pj_pool_t *pool, const pj_dns_parsed_packet*p, + unsigned options, pj_dns_parsed_packet **p_dst); |