Electroneum
Loading...
Searching...
No Matches
unbound.h
Go to the documentation of this file.
1/*
2 * unbound.h - unbound validating resolver public API
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * Neither the name of the NLNET LABS nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
97#ifndef _UB_UNBOUND_H
98#define _UB_UNBOUND_H
99
100#ifdef __cplusplus
101extern "C" {
102#endif
103
105#define UNBOUND_VERSION_MAJOR @UNBOUND_VERSION_MAJOR@
106#define UNBOUND_VERSION_MINOR @UNBOUND_VERSION_MINOR@
107#define UNBOUND_VERSION_MICRO @UNBOUND_VERSION_MICRO@
108
116struct ub_ctx;
117
123struct ub_result {
125 char* qname;
127 int qtype;
130
137 char** data;
138
140 int* len;
141
148
153 int rcode;
154
161
167
174
184
196 int bogus;
197
205
210 int ttl;
211};
212
226typedef void (*ub_callback_type)(void*, int, struct ub_result*);
227
235struct ub_ctx* ub_ctx_create(void);
236
242void ub_ctx_delete(struct ub_ctx* ctx);
243
257int ub_ctx_set_option(struct ub_ctx* ctx, const char* opt, const char* val);
258
273int ub_ctx_get_option(struct ub_ctx* ctx, const char* opt, char** str);
274
285int ub_ctx_config(struct ub_ctx* ctx, const char* fname);
286
304int ub_ctx_set_fwd(struct ub_ctx* ctx, const char* addr);
305
324int ub_ctx_set_stub(struct ub_ctx* ctx, const char* zone, const char* addr,
325 int isprime);
326
341int ub_ctx_resolvconf(struct ub_ctx* ctx, const char* fname);
342
354int ub_ctx_hosts(struct ub_ctx* ctx, const char* fname);
355
367int ub_ctx_add_ta(struct ub_ctx* ctx, const char* ta);
368
378int ub_ctx_add_ta_file(struct ub_ctx* ctx, const char* fname);
379
393int ub_ctx_add_ta_autr(struct ub_ctx* ctx, const char* fname);
394
405int ub_ctx_trustedkeys(struct ub_ctx* ctx, const char* fname);
406
415int ub_ctx_debugout(struct ub_ctx* ctx, void* out);
416
425int ub_ctx_debuglevel(struct ub_ctx* ctx, int d);
426
437int ub_ctx_async(struct ub_ctx* ctx, int dothread);
438
447int ub_poll(struct ub_ctx* ctx);
448
456int ub_wait(struct ub_ctx* ctx);
457
467int ub_fd(struct ub_ctx* ctx);
468
476int ub_process(struct ub_ctx* ctx);
477
490int ub_resolve(struct ub_ctx* ctx, const char* name, int rrtype,
491 int rrclass, struct ub_result** result);
492
521int ub_resolve_async(struct ub_ctx* ctx, const char* name, int rrtype,
522 int rrclass, void* mydata, ub_callback_type callback, int* async_id);
523
537int ub_cancel(struct ub_ctx* ctx, int async_id);
538
543void ub_resolve_free(struct ub_result* result);
544
550const char* ub_strerror(int err);
551
558
568int ub_ctx_zone_add(struct ub_ctx* ctx, const char *zone_name,
569 const char *zone_type);
570
578int ub_ctx_zone_remove(struct ub_ctx* ctx, const char *zone_name);
579
588int ub_ctx_data_add(struct ub_ctx* ctx, const char *data);
589
596int ub_ctx_data_remove(struct ub_ctx* ctx, const char *data);
597
602const char* ub_version(void);
603
610
611 struct {
612 long long now_sec, now_usec;
613 long long up_sec, up_usec;
616
617 struct {
618 long long msg;
619 long long rrset;
620 long long val;
621 long long iter;
622 long long subnet;
623 long long ipsecmod;
624 long long respip;
626 long long dnscrypt_nonce;
628};
629
631#define UB_STATS_QTYPE_NUM 256
633#define UB_STATS_QCLASS_NUM 256
635#define UB_STATS_RCODE_NUM 16
637#define UB_STATS_OPCODE_NUM 16
639#define UB_STATS_BUCKET_NUM 40
640
644 long long num_queries;
651
659
662
666 long long qtype_big;
670 long long qclass_big;
674 long long qtcp;
676 long long qtcp_outgoing;
678 long long qipv6;
680 long long qbit_QR;
682 long long qbit_AA;
684 long long qbit_TC;
686 long long qbit_RD;
688 long long qbit_RA;
690 long long qbit_Z;
692 long long qbit_AD;
694 long long qbit_CD;
696 long long qEDNS;
698 long long qEDNS_DO;
704 long long ans_secure;
706 long long ans_bogus;
708 long long rrset_bogus;
724
733
760};
761
786
787#ifdef __cplusplus
788}
789#endif
790
791#endif /* _UB_UNBOUND_H */
time_t time
int dothread
Definition context.h:91
char * qname
Definition unbound.h:125
int qclass
Definition unbound.h:129
int * len
Definition unbound.h:140
int qtype
Definition unbound.h:127
int bogus
Definition unbound.h:196
char * why_bogus
Definition unbound.h:204
int havedata
Definition unbound.h:166
int rcode
Definition unbound.h:153
char * canonname
Definition unbound.h:147
char ** data
Definition unbound.h:137
int ttl
Definition unbound.h:210
int answer_len
Definition unbound.h:160
void * answer_packet
Definition unbound.h:158
int secure
Definition unbound.h:183
int nxdomain
Definition unbound.h:173
long long max_query_list_size
Definition unbound.h:658
long long ans_secure
Definition unbound.h:704
long long num_queries_prefetch
Definition unbound.h:650
long long qipv6
Definition unbound.h:678
long long num_query_authzone_up
Definition unbound.h:751
long long qclass_big
Definition unbound.h:670
long long qtype_big
Definition unbound.h:666
long long num_query_dnscrypt_secret_missed_cache
Definition unbound.h:743
long long ans_rcode_nodata
Definition unbound.h:702
long long qbit_Z
Definition unbound.h:690
long long qtcp_outgoing
Definition unbound.h:676
long long qtcp
Definition unbound.h:674
long long num_queries_missed_cache
Definition unbound.h:648
long long num_query_authzone_down
Definition unbound.h:753
long long infra_cache_count
Definition unbound.h:730
long long num_neg_cache_noerror
Definition unbound.h:756
long long num_query_dnscrypt_replay
Definition unbound.h:747
long long qopcode[UB_STATS_OPCODE_NUM]
Definition unbound.h:672
long long qbit_RD
Definition unbound.h:686
long long rrset_bogus
Definition unbound.h:708
long long qbit_QR
Definition unbound.h:680
long long qEDNS_DO
Definition unbound.h:698
long long hist[UB_STATS_BUCKET_NUM]
Definition unbound.h:723
long long num_query_dnscrypt_crypted
Definition unbound.h:735
long long qbit_AA
Definition unbound.h:682
long long num_queries
Definition unbound.h:644
long long qclass[UB_STATS_QCLASS_NUM]
Definition unbound.h:668
long long nonce_cache_count
Definition unbound.h:749
long long qbit_TC
Definition unbound.h:684
long long zero_ttl_responses
Definition unbound.h:718
long long unwanted_queries
Definition unbound.h:714
long long num_neg_cache_nxdomain
Definition unbound.h:759
long long qEDNS
Definition unbound.h:696
long long qbit_RA
Definition unbound.h:688
long long num_queries_ip_ratelimited
Definition unbound.h:646
long long key_cache_count
Definition unbound.h:732
long long num_query_dnscrypt_cert
Definition unbound.h:737
long long shared_secret_cache_count
Definition unbound.h:745
long long queries_ratelimited
Definition unbound.h:710
long long ans_rcode[UB_STATS_RCODE_NUM]
Definition unbound.h:700
long long ans_bogus
Definition unbound.h:706
long long msg_cache_count
Definition unbound.h:726
long long qbit_AD
Definition unbound.h:692
long long rrset_cache_count
Definition unbound.h:728
long long unwanted_replies
Definition unbound.h:712
long long num_query_dnscrypt_crypted_malformed
Definition unbound.h:741
long long qtype[UB_STATS_QTYPE_NUM]
Definition unbound.h:664
long long tcp_accept_usage
Definition unbound.h:716
long long qbit_CD
Definition unbound.h:694
long long sum_query_list_size
Definition unbound.h:656
long long num_query_dnscrypt_cleartext
Definition unbound.h:739
long long iter
Definition unbound.h:621
long long elapsed_sec
Definition unbound.h:614
long long ipsecmod
Definition unbound.h:623
long long up_sec
Definition unbound.h:613
long long rrset
Definition unbound.h:619
long long respip
Definition unbound.h:624
long long now_usec
Definition unbound.h:612
long long now_sec
Definition unbound.h:612
struct ub_shm_stat_info::@230027022114004263207216234363354200007317305102 mem
long long dnscrypt_shared_secret
Definition unbound.h:625
long long elapsed_usec
Definition unbound.h:614
long long val
Definition unbound.h:620
long long up_usec
Definition unbound.h:613
long long msg
Definition unbound.h:618
long long dnscrypt_nonce
Definition unbound.h:626
long long subnet
Definition unbound.h:622
struct ub_server_stats svr
Definition unbound.h:769
long long mesh_replies_sent
Definition unbound.h:780
long long mesh_num_states
Definition unbound.h:772
long long mesh_jostled
Definition unbound.h:776
long long mesh_replies_sum_wait_sec
Definition unbound.h:782
long long mesh_dropped
Definition unbound.h:778
double mesh_time_median
Definition unbound.h:784
long long mesh_replies_sum_wait_usec
Definition unbound.h:782
long long mesh_num_reply_states
Definition unbound.h:774
int ub_ctx_debugout(struct ub_ctx *ctx, void *out)
void ub_ctx_delete(struct ub_ctx *ctx)
int ub_ctx_data_remove(struct ub_ctx *ctx, const char *data)
int ub_ctx_add_ta_file(struct ub_ctx *ctx, const char *fname)
int ub_process(struct ub_ctx *ctx)
int ub_ctx_async(struct ub_ctx *ctx, int dothread)
int ub_ctx_set_option(struct ub_ctx *ctx, const char *opt, const char *val)
int ub_wait(struct ub_ctx *ctx)
int ub_poll(struct ub_ctx *ctx)
int ub_ctx_trustedkeys(struct ub_ctx *ctx, const char *fname)
int ub_ctx_data_add(struct ub_ctx *ctx, const char *data)
int ub_ctx_config(struct ub_ctx *ctx, const char *fname)
int ub_ctx_set_stub(struct ub_ctx *ctx, const char *zone, const char *addr, int isprime)
void ub_resolve_free(struct ub_result *result)
#define UB_STATS_QTYPE_NUM
Definition unbound.h:631
#define UB_STATS_QCLASS_NUM
Definition unbound.h:633
int ub_ctx_add_ta(struct ub_ctx *ctx, const char *ta)
int ub_resolve_async(struct ub_ctx *ctx, const char *name, int rrtype, int rrclass, void *mydata, ub_callback_type callback, int *async_id)
void(* ub_callback_type)(void *, int, struct ub_result *)
Definition unbound.h:226
int ub_cancel(struct ub_ctx *ctx, int async_id)
int ub_ctx_set_fwd(struct ub_ctx *ctx, const char *addr)
int ub_ctx_zone_remove(struct ub_ctx *ctx, const char *zone_name)
int ub_ctx_print_local_zones(struct ub_ctx *ctx)
#define UB_STATS_RCODE_NUM
Definition unbound.h:635
const char * ub_version(void)
const char * ub_strerror(int err)
int ub_ctx_hosts(struct ub_ctx *ctx, const char *fname)
int ub_fd(struct ub_ctx *ctx)
int ub_ctx_get_option(struct ub_ctx *ctx, const char *opt, char **str)
int ub_ctx_resolvconf(struct ub_ctx *ctx, const char *fname)
int ub_ctx_debuglevel(struct ub_ctx *ctx, int d)
struct ub_ctx * ub_ctx_create(void)
int ub_ctx_add_ta_autr(struct ub_ctx *ctx, const char *fname)
#define UB_STATS_BUCKET_NUM
Definition unbound.h:639
#define UB_STATS_OPCODE_NUM
Definition unbound.h:637
int ub_ctx_zone_add(struct ub_ctx *ctx, const char *zone_name, const char *zone_type)
int ub_resolve(struct ub_ctx *ctx, const char *name, int rrtype, int rrclass, struct ub_result **result)