Home --> Documentations --> PJLIB-UTIL Reference

resolver.h
Go to the documentation of this file.
1 /* $Id: resolver.h 5349 2016-06-20 10:10:42Z nanang $ */
2 /*
3  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 #ifndef __PJLIB_UTIL_RESOLVER_H__
21 #define __PJLIB_UTIL_RESOLVER_H__
22 
27 #include <pjlib-util/dns.h>
28 
29 
31 
32 
166 
171 
182 typedef void pj_dns_callback(void *user_data,
183  pj_status_t status,
184  pj_dns_parsed_packet *response);
185 
186 
190 typedef struct pj_dns_settings
191 {
192  unsigned options;
193  unsigned qretr_delay;
194  unsigned qretr_count;
195  unsigned cache_max_ttl;
197  unsigned good_ns_ttl;
198  unsigned bad_ns_ttl;
200 
201 
206 typedef struct pj_dns_a_record
207 {
210 
215 
217  unsigned addr_count;
218 
221 
223  char buf_[128];
224 
226 
227 
233 typedef struct pj_dns_addr_record
234 {
237 
242 
244  unsigned addr_count;
245 
247  struct {
248 
250  int af;
251 
253  union {
256 
259  } ip;
260 
262 
264  char buf_[128];
265 
267 
268 
274 PJ_DECL(void) pj_dns_settings_default(pj_dns_settings *s);
275 
276 
302  const char *name,
303  unsigned options,
304  pj_timer_heap_t *timer,
305  pj_ioqueue_t *ioqueue,
306  pj_dns_resolver **p_resolver);
307 
308 
326  unsigned count,
327  const pj_str_t servers[],
328  const pj_uint16_t ports[]);
329 
330 
340  pj_dns_settings *st);
341 
342 
354  const pj_dns_settings *st);
355 
356 
368 PJ_DECL(void) pj_dns_resolver_handle_events(pj_dns_resolver *resolver,
369  const pj_time_val *timeout);
370 
371 
383  pj_bool_t notify);
384 
385 
418  const pj_str_t *name,
419  int type,
420  unsigned options,
421  pj_dns_callback *cb,
422  void *user_data,
423  pj_dns_async_query **p_query);
424 
435  pj_bool_t notify);
436 
448  pj_dns_a_record *rec);
449 
450 
462  const pj_dns_parsed_packet *pkt,
463  pj_dns_addr_record *rec);
464 
465 
484  const pj_dns_parsed_packet *pkt,
485  pj_bool_t set_ttl);
486 
495 PJ_DECL(unsigned) pj_dns_resolver_get_cached_count(pj_dns_resolver *resolver);
496 
497 
504 PJ_DECL(void) pj_dns_resolver_dump(pj_dns_resolver *resolver,
505  pj_bool_t detail);
506 
507 
512 PJ_END_DECL
513 
514 
515 #endif /* __PJLIB_UTIL_RESOLVER_H__ */
516 
pj_status_t pj_dns_resolver_destroy(pj_dns_resolver *resolver, pj_bool_t notify)
struct pj_timer_heap_t pj_timer_heap_t
union pj_dns_addr_record::@2::@3 ip
pj_str_t alias
Definition: resolver.h:214
unsigned qretr_count
Definition: resolver.h:194
pj_status_t pj_dns_resolver_get_settings(pj_dns_resolver *resolver, pj_dns_settings *st)
struct pj_dns_resolver pj_dns_resolver
Definition: resolver.h:165
int pj_bool_t
void * user_data
unsigned pj_dns_resolver_get_cached_count(pj_dns_resolver *resolver)
pj_str_t name
Definition: resolver.h:209
#define PJ_DNS_MAX_IP_IN_A_REC
Definition: config.h:44
pj_status_t pj_dns_resolver_create(pj_pool_factory *pf, const char *name, unsigned options, pj_timer_heap_t *timer, pj_ioqueue_t *ioqueue, pj_dns_resolver **p_resolver)
pj_status_t pj_dns_resolver_cancel_query(pj_dns_async_query *query, pj_bool_t notify)
void pj_dns_resolver_dump(pj_dns_resolver *resolver, pj_bool_t detail)
void pj_dns_resolver_handle_events(pj_dns_resolver *resolver, const pj_time_val *timeout)
Definition: resolver.h:233
pj_status_t pj_dns_parse_a_response(const pj_dns_parsed_packet *pkt, pj_dns_a_record *rec)
int af
Definition: resolver.h:250
int pj_status_t
unsigned addr_count
Definition: resolver.h:244
pj_str_t alias
Definition: resolver.h:241
pj_status_t pj_dns_resolver_start_query(pj_dns_resolver *resolver, const pj_str_t *name, int type, unsigned options, pj_dns_callback *cb, void *user_data, pj_dns_async_query **p_query)
struct pj_ioqueue_t pj_ioqueue_t
Definition: resolver.h:206
struct pj_dns_async_query pj_dns_async_query
Definition: resolver.h:170
pj_status_t pj_dns_parse_addr_response(const pj_dns_parsed_packet *pkt, pj_dns_addr_record *rec)
unsigned bad_ns_ttl
Definition: resolver.h:198
#define PJ_BEGIN_DECL
pj_in6_addr v6
Definition: resolver.h:258
pj_in_addr v4
Definition: resolver.h:255
Definition: dns.h:283
unsigned addr_count
Definition: resolver.h:217
Low level DNS message parsing and packetization.
pj_str_t name
Definition: resolver.h:236
void pj_dns_callback(void *user_data, pj_status_t status, pj_dns_parsed_packet *response)
Definition: resolver.h:182
unsigned qretr_delay
Definition: resolver.h:193
unsigned options
Definition: resolver.h:192
pj_status_t pj_dns_resolver_set_ns(pj_dns_resolver *resolver, unsigned count, const pj_str_t servers[], const pj_uint16_t ports[])
void pj_dns_settings_default(pj_dns_settings *s)
pj_status_t pj_dns_resolver_add_entry(pj_dns_resolver *resolver, const pj_dns_parsed_packet *pkt, pj_bool_t set_ttl)
Definition: resolver.h:190
pj_in_addr addr[PJ_DNS_MAX_IP_IN_A_REC]
Definition: resolver.h:220
unsigned cache_max_ttl
Definition: resolver.h:195
char buf_[128]
Definition: resolver.h:264
pj_status_t pj_dns_resolver_set_settings(pj_dns_resolver *resolver, const pj_dns_settings *st)
unsigned short pj_uint16_t
char buf_[128]
Definition: resolver.h:223
struct pj_dns_addr_record::@2 addr[PJ_DNS_MAX_IP_IN_A_REC]
unsigned good_ns_ttl
Definition: resolver.h:197

 


PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library
Copyright (C) 2006-2009 Teluu Inc.