Electroneum
dnstap.h
Go to the documentation of this file.
1 /* dnstap support for Unbound */
2 
3 /*
4  * Copyright (c) 2013-2014, Farsight Security, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
26  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef UNBOUND_DNSTAP_H
36 #define UNBOUND_DNSTAP_H
37 
38 #include "dnstap/dnstap_config.h"
39 
40 #ifdef USE_DNSTAP
41 
42 struct config_file;
43 struct fstrm_io;
44 struct fstrm_queue;
45 struct sldns_buffer;
46 
47 struct dt_env {
49  struct fstrm_iothr *iothr;
50 
52  struct fstrm_iothr_queue *ioq;
53 
55  char *identity;
56 
58  char *version;
59 
61  unsigned len_identity;
62 
64  unsigned len_version;
65 
67  unsigned log_resolver_query_messages : 1;
69  unsigned log_resolver_response_messages : 1;
71  unsigned log_client_query_messages : 1;
73  unsigned log_client_response_messages : 1;
75  unsigned log_forwarder_query_messages : 1;
77  unsigned log_forwarder_response_messages : 1;
78 };
79 
91 struct dt_env *
92 dt_create(const char *socket_path, unsigned num_workers);
93 
99 void
100 dt_apply_cfg(struct dt_env *env, struct config_file *cfg);
101 
107 int
108 dt_init(struct dt_env *env);
109 
114 void
115 dt_delete(struct dt_env *env);
116 
124 void
125 dt_msg_send_client_query(struct dt_env *env,
126  struct sockaddr_storage *qsock,
127  enum comm_point_type cptype,
128  struct sldns_buffer *qmsg);
129 
137 void
138 dt_msg_send_client_response(struct dt_env *env,
139  struct sockaddr_storage *qsock,
140  enum comm_point_type cptype,
141  struct sldns_buffer *rmsg);
142 
154 void
155 dt_msg_send_outside_query(struct dt_env *env,
156  struct sockaddr_storage *rsock,
157  enum comm_point_type cptype,
158  uint8_t *zone, size_t zone_len,
159  struct sldns_buffer *qmsg);
160 
176 void
177 dt_msg_send_outside_response(struct dt_env *env,
178  struct sockaddr_storage *rsock,
179  enum comm_point_type cptype,
180  uint8_t *zone, size_t zone_len,
181  uint8_t *qbuf, size_t qbuf_len,
182  const struct timeval *qtime,
183  const struct timeval *rtime,
184  struct sldns_buffer *rmsg);
185 
186 #endif /* USE_DNSTAP */
187 
188 #endif /* UNBOUND_DNSTAP_H */
unsigned char uint8_t
Definition: stdint.h:124
version
Supported socks variants.
Definition: socks.h:57
key identity()
Definition: rctOps.h:73