GNUnet  0.17.6
gnunet_dnsstub_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2012, 2018 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
34 #ifndef GNUNET_DNSSTUB_LIB_H
35 #define GNUNET_DNSSTUB_LIB_H
36 
37 #include "gnunet_util_lib.h"
38 
43 
48 
49 
58 GNUNET_DNSSTUB_start (unsigned int num_sockets);
59 
60 
69 int
71  const char *dns_ip);
72 
73 
82 int
84  const struct sockaddr *sa);
85 
86 
94 void
97 
103 void
105 
106 
117 typedef void
118 (*GNUNET_DNSSTUB_ResultCallback)(void *cls,
119  const struct GNUNET_TUN_DnsHeader *dns,
120  size_t dns_len);
121 
122 
135  const void *request,
136  size_t request_len,
138  void *rc_cls);
139 
140 
146 void
148 
149 
150 #endif
151  /* end of group */
153  /* end of group addition */
static char * dns_ip
IP of DNS server.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:41
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
int GNUNET_DNSSTUB_add_dns_ip(struct GNUNET_DNSSTUB_Context *ctx, const char *dns_ip)
Add nameserver for use by the DNSSTUB.
Definition: dnsstub.c:617
void(* GNUNET_DNSSTUB_ResultCallback)(void *cls, const struct GNUNET_TUN_DnsHeader *dns, size_t dns_len)
Function called with the result of a DNS resolution.
void GNUNET_DNSSTUB_stop(struct GNUNET_DNSSTUB_Context *ctx)
Cleanup DNSSTUB resolver.
Definition: dnsstub.c:716
void GNUNET_DNSSTUB_set_retry(struct GNUNET_DNSSTUB_Context *ctx, struct GNUNET_TIME_Relative retry_freq)
How long should we try requests before timing out? Only effective for requests issued after this call...
Definition: dnsstub.c:703
struct GNUNET_DNSSTUB_Context * GNUNET_DNSSTUB_start(unsigned int num_sockets)
Start a DNS stub resolver.
Definition: dnsstub.c:590
void GNUNET_DNSSTUB_resolve_cancel(struct GNUNET_DNSSTUB_RequestSocket *rs)
Cancel DNS resolution.
Definition: dnsstub.c:566
struct GNUNET_DNSSTUB_RequestSocket * GNUNET_DNSSTUB_resolve(struct GNUNET_DNSSTUB_Context *ctx, const void *request, size_t request_len, GNUNET_DNSSTUB_ResultCallback rc, void *rc_cls)
Perform DNS resolution using our default IP from init.
Definition: dnsstub.c:530
int GNUNET_DNSSTUB_add_dns_sa(struct GNUNET_DNSSTUB_Context *ctx, const struct sockaddr *sa)
Add nameserver for use by the DNSSTUB.
Definition: dnsstub.c:669
Handle to the stub resolver.
Definition: dnsstub.c:124
unsigned int num_sockets
Length of sockets array.
Definition: dnsstub.c:148
struct GNUNET_TIME_Relative retry_freq
How frequently do we retry requests?
Definition: dnsstub.c:143
UDP socket we are using for sending DNS requests to the Internet.
Definition: dnsstub.c:45
GNUNET_DNSSTUB_ResultCallback rc
Function to call with result.
Definition: dnsstub.c:59
size_t request_len
Number of bytes in request.
Definition: dnsstub.c:94
void * rc_cls
Closure for rc.
Definition: dnsstub.c:64
Time for relative time used by GNUnet, in microseconds.