BLOG | DOCUMENTATION | GITHUB

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

resolver.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJLIB_UTIL_RESOLVER_H__
20#define __PJLIB_UTIL_RESOLVER_H__
21
26#include <pjlib-util/dns.h>
27
28
30
31
165
170
181typedef void pj_dns_callback(void *user_data,
182 pj_status_t status,
183 pj_dns_parsed_packet *response);
184
185
189typedef struct pj_dns_settings
190{
191 unsigned options;
192 unsigned qretr_delay;
193 unsigned qretr_count;
194 unsigned cache_max_ttl;
196 unsigned good_ns_ttl;
197 unsigned bad_ns_ttl;
199
200
205typedef struct pj_dns_a_record
206{
209
214
216 unsigned addr_count;
217
220
222 char buf_[128];
223
225
226
232typedef struct pj_dns_addr_record
233{
236
241
243 unsigned addr_count;
244
246 struct {
247
249 int af;
250
252 union {
255
258 } ip;
259
261
263 char buf_[128];
264
266
267
274
275
301 const char *name,
302 unsigned options,
303 pj_timer_heap_t *timer,
304 pj_ioqueue_t *ioqueue,
305 pj_dns_resolver **p_resolver);
306
307
325 unsigned count,
326 const pj_str_t servers[],
327 const pj_uint16_t ports[]);
328
329
339 pj_dns_settings *st);
340
341
353 const pj_dns_settings *st);
354
355
368 const pj_time_val *timeout);
369
370
382 pj_bool_t notify);
383
384
417 const pj_str_t *name,
418 int type,
419 unsigned options,
420 pj_dns_callback *cb,
421 void *user_data,
422 pj_dns_async_query **p_query);
423
434 pj_bool_t notify);
435
447 pj_dns_a_record *rec);
448
449
461 const pj_dns_parsed_packet *pkt,
462 pj_dns_addr_record *rec);
463
464
483 const pj_dns_parsed_packet *pkt,
484 pj_bool_t set_ttl);
485
495
496
503PJ_DECL(void) pj_dns_resolver_dump(pj_dns_resolver *resolver,
504 pj_bool_t detail);
505
506
512
513
514#endif /* __PJLIB_UTIL_RESOLVER_H__ */
515
Low level DNS message parsing and packetization.
#define PJ_DNS_MAX_IP_IN_A_REC
Definition: config.h:43
int pj_bool_t
struct pj_ioqueue_t pj_ioqueue_t
unsigned short pj_uint16_t
int pj_status_t
struct pj_timer_heap_t pj_timer_heap_t
pj_status_t pj_dns_parse_addr_response(const pj_dns_parsed_packet *pkt, pj_dns_addr_record *rec)
pj_status_t pj_dns_resolver_destroy(pj_dns_resolver *resolver, pj_bool_t notify)
void pj_dns_resolver_dump(pj_dns_resolver *resolver, pj_bool_t detail)
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)
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)
struct pj_dns_resolver pj_dns_resolver
Definition: resolver.h:164
pj_status_t pj_dns_resolver_add_entry(pj_dns_resolver *resolver, const pj_dns_parsed_packet *pkt, pj_bool_t set_ttl)
void pj_dns_resolver_handle_events(pj_dns_resolver *resolver, const pj_time_val *timeout)
pj_status_t pj_dns_resolver_get_settings(pj_dns_resolver *resolver, pj_dns_settings *st)
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_set_settings(pj_dns_resolver *resolver, const pj_dns_settings *st)
pj_status_t pj_dns_parse_a_response(const pj_dns_parsed_packet *pkt, pj_dns_a_record *rec)
unsigned pj_dns_resolver_get_cached_count(pj_dns_resolver *resolver)
pj_status_t pj_dns_resolver_cancel_query(pj_dns_async_query *query, pj_bool_t notify)
struct pj_dns_async_query pj_dns_async_query
Definition: resolver.h:169
void pj_dns_callback(void *user_data, pj_status_t status, pj_dns_parsed_packet *response)
Definition: resolver.h:181
struct in_addr pj_in_addr
struct in6_addr pj_in6_addr
#define PJ_BEGIN_DECL
#define PJ_END_DECL
Definition: resolver.h:206
unsigned addr_count
Definition: resolver.h:216
pj_in_addr addr[PJ_DNS_MAX_IP_IN_A_REC]
Definition: resolver.h:219
char buf_[128]
Definition: resolver.h:222
pj_str_t alias
Definition: resolver.h:213
pj_str_t name
Definition: resolver.h:208
Definition: resolver.h:233
pj_in_addr v4
Definition: resolver.h:254
char buf_[128]
Definition: resolver.h:263
union pj_dns_addr_record::@2::@3 ip
struct pj_dns_addr_record::@2 addr[PJ_DNS_MAX_IP_IN_A_REC]
pj_str_t name
Definition: resolver.h:235
pj_str_t alias
Definition: resolver.h:240
pj_in6_addr v6
Definition: resolver.h:257
int af
Definition: resolver.h:249
unsigned addr_count
Definition: resolver.h:243
Definition: dns.h:283
Definition: resolver.h:190
unsigned good_ns_ttl
Definition: resolver.h:196
unsigned qretr_count
Definition: resolver.h:193
unsigned qretr_delay
Definition: resolver.h:192
unsigned bad_ns_ttl
Definition: resolver.h:197
unsigned options
Definition: resolver.h:191
unsigned cache_max_ttl
Definition: resolver.h:194

 


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.