Electroneum
listen_dnsport.h
Go to the documentation of this file.
1 /*
2  * services/listen_dnsport.h - listen on port 53 for incoming DNS queries.
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 
42 #ifndef LISTEN_DNSPORT_H
43 #define LISTEN_DNSPORT_H
44 
45 #include "util/netevent.h"
46 struct listen_list;
47 struct config_file;
48 struct addrinfo;
49 struct sldns_buffer;
50 
57  struct comm_base* base;
58 
62 #ifdef USE_DNSCRYPT
63  struct sldns_buffer* dnscrypt_udp_buff;
64 #endif
65 
66  struct listen_list* cps;
67 };
68 
72 struct listen_list {
74  struct listen_list* next;
76  struct comm_point* com;
77 };
78 
97 
98 };
99 
104 struct listen_port {
106  struct listen_port* next;
108  int fd;
111 };
112 
124 struct listen_port* listening_ports_open(struct config_file* cfg,
125  int* reuseport);
126 
130 void listening_ports_free(struct listen_port* list);
131 
148  struct listen_port* ports, size_t bufsize, int tcp_accept_count,
149  void* sslctx, struct dt_env *dtenv, comm_point_callback_type* cb,
150  void* cb_arg);
151 
156 void listen_delete(struct listen_dnsport* listen);
157 
163 void listen_list_delete(struct listen_list* list);
164 
170 size_t listen_get_mem(struct listen_dnsport* listen);
171 
176 void listen_stop_accept(struct listen_dnsport* listen);
177 
182 void listen_start_accept(struct listen_dnsport* listen);
183 
206 int create_udp_sock(int family, int socktype, struct sockaddr* addr,
207  socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv,
208  int snd, int listen, int* reuseport, int transparent, int freebind, int use_systemd);
209 
223 int create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
224  int* reuseport, int transparent, int mss, int freebind, int use_systemd);
225 
234 int create_local_accept_sock(const char* path, int* noproto, int use_systemd);
235 
236 #endif /* LISTEN_DNSPORT_H */
void listen_list_delete(struct listen_list *list)
void listen_start_accept(struct listen_dnsport *listen)
int create_local_accept_sock(const char *path, int *noproto, int use_systemd)
int comm_point_callback_type(struct comm_point *, void *, int, struct comm_reply *)
Definition: netevent.h:76
struct comm_point * com
struct listen_list * next
int create_udp_sock(int family, int socktype, struct sockaddr *addr, socklen_t addrlen, int v6only, int *inuse, int *noproto, int rcv, int snd, int listen, int *reuseport, int transparent, int freebind, int use_systemd)
enum listen_type ftype
void listen_delete(struct listen_dnsport *listen)
listen_type
void listen_stop_accept(struct listen_dnsport *listen)
int create_tcp_accept_sock(struct addrinfo *addr, int v6only, int *noproto, int *reuseport, int transparent, int mss, int freebind, int use_systemd)
struct listen_dnsport * listen_create(struct comm_base *base, struct listen_port *ports, size_t bufsize, int tcp_accept_count, void *sslctx, struct dt_env *dtenv, comm_point_callback_type *cb, void *cb_arg)
struct listen_port * next
struct comm_base * base
struct listen_list * cps
void listening_ports_free(struct listen_port *list)
size_t listen_get_mem(struct listen_dnsport *listen)
struct listen_port * listening_ports_open(struct config_file *cfg, int *reuseport)
struct sldns_buffer * udp_buff