Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
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
41
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
55
struct
listen_dnsport
{
57
struct
comm_base
*
base
;
58
61
struct
sldns_buffer
*
udp_buff
;
62
#ifdef USE_DNSCRYPT
63
struct
sldns_buffer
* dnscrypt_udp_buff;
64
#endif
66
struct
listen_list
*
cps
;
67
};
68
72
struct
listen_list
{
74
struct
listen_list
*
next
;
76
struct
comm_point
*
com
;
77
};
78
82
enum
listen_type
{
84
listen_type_udp
,
86
listen_type_tcp
,
88
listen_type_udpancil
,
90
listen_type_ssl
,
92
listen_type_udp_dnscrypt
,
94
listen_type_tcp_dnscrypt
,
96
listen_type_udpancil_dnscrypt
97
98
};
99
104
struct
listen_port
{
106
struct
listen_port
*
next
;
108
int
fd
;
110
enum
listen_type
ftype
;
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
147
struct
listen_dnsport
*
listen_create
(
struct
comm_base
*
base
,
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 */
listen_stop_accept
void listen_stop_accept(struct listen_dnsport *listen)
create_udp_sock
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)
listen_type
listen_type
Definition
listen_dnsport.h:82
listen_type_tcp_dnscrypt
@ listen_type_tcp_dnscrypt
Definition
listen_dnsport.h:94
listen_type_udpancil
@ listen_type_udpancil
Definition
listen_dnsport.h:88
listen_type_udpancil_dnscrypt
@ listen_type_udpancil_dnscrypt
Definition
listen_dnsport.h:96
listen_type_udp
@ listen_type_udp
Definition
listen_dnsport.h:84
listen_type_udp_dnscrypt
@ listen_type_udp_dnscrypt
Definition
listen_dnsport.h:92
listen_type_tcp
@ listen_type_tcp
Definition
listen_dnsport.h:86
listen_type_ssl
@ listen_type_ssl
Definition
listen_dnsport.h:90
listen_start_accept
void listen_start_accept(struct listen_dnsport *listen)
listen_list_delete
void listen_list_delete(struct listen_list *list)
listen_delete
void listen_delete(struct listen_dnsport *listen)
listening_ports_free
void listening_ports_free(struct listen_port *list)
create_tcp_accept_sock
int create_tcp_accept_sock(struct addrinfo *addr, int v6only, int *noproto, int *reuseport, int transparent, int mss, int freebind, int use_systemd)
listen_create
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)
listening_ports_open
struct listen_port * listening_ports_open(struct config_file *cfg, int *reuseport)
create_local_accept_sock
int create_local_accept_sock(const char *path, int *noproto, int use_systemd)
listen_get_mem
size_t listen_get_mem(struct listen_dnsport *listen)
netevent.h
comm_point_callback_type
int comm_point_callback_type(struct comm_point *, void *, int, struct comm_reply *)
Definition
netevent.h:76
addrinfo
Definition
fake-rfc2553.h:136
comm_base
Definition
netevent.h:96
comm_point
Definition
netevent.h:154
config_file
Definition
config_file.h:68
listen_dnsport
Definition
listen_dnsport.h:55
listen_dnsport::udp_buff
struct sldns_buffer * udp_buff
Definition
listen_dnsport.h:61
listen_dnsport::cps
struct listen_list * cps
Definition
listen_dnsport.h:66
listen_dnsport::base
struct comm_base * base
Definition
listen_dnsport.h:57
listen_list
Definition
listen_dnsport.h:72
listen_list::com
struct comm_point * com
Definition
listen_dnsport.h:76
listen_list::next
struct listen_list * next
Definition
listen_dnsport.h:74
listen_port
Definition
listen_dnsport.h:104
listen_port::next
struct listen_port * next
Definition
listen_dnsport.h:106
listen_port::fd
int fd
Definition
listen_dnsport.h:108
listen_port::ftype
enum listen_type ftype
Definition
listen_dnsport.h:110
sldns_buffer
Definition
sbuffer.h:117
external
unbound
services
listen_dnsport.h
Generated on
for Electroneum by
1.17.0