GNUnet 0.21.1
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
21#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
22#error "Only <gnunet_util_lib.h> can be included directly."
23#endif
24
38#ifndef GNUNET_DNSSTUB_LIB_H
39#define GNUNET_DNSSTUB_LIB_H
40
41
42#include "gnunet_util_lib.h"
43
48
53
54
64
65
74int
76 const char *dns_ip);
77
78
87int
89 const struct sockaddr *sa);
90
91
99void
102
108void
110
111
122typedef void
124 const struct GNUNET_TUN_DnsHeader *dns,
125 size_t dns_len);
126
127
140 const void *request,
141 size_t request_len,
143 void *rc_cls);
144
145
151void
153
154
155#endif
156 /* end of group */
158 /* end of group addition */
static char * dns_ip
IP of DNS server.
static struct GNUNET_FS_Handle * ctx
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:40
struct GNUNET_DNSSTUB_Context * GNUNET_DNSSTUB_start(unsigned int num_sockets)
Start a DNS stub resolver.
Definition: dnsstub.c:586
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:613
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:705
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:692
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:526
void GNUNET_DNSSTUB_resolve_cancel(struct GNUNET_DNSSTUB_RequestSocket *rs)
Cancel DNS resolution.
Definition: dnsstub.c:562
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:665
Handle to the stub resolver.
Definition: dnsstub.c:125
unsigned int num_sockets
Length of sockets array.
Definition: dnsstub.c:149
struct GNUNET_TIME_Relative retry_freq
How frequently do we retry requests?
Definition: dnsstub.c:144
UDP socket we are using for sending DNS requests to the Internet.
Definition: dnsstub.c:46
GNUNET_DNSSTUB_ResultCallback rc
Function to call with result.
Definition: dnsstub.c:60
size_t request_len
Number of bytes in request.
Definition: dnsstub.c:95
void * rc_cls
Closure for rc.
Definition: dnsstub.c:65
Time for relative time used by GNUnet, in microseconds.