GNUnet 0.22.2
gnunet-service-gns_interceptor.h File Reference

GNUnet GNS service. More...

#include "gnunet_util_lib.h"
Include dependency graph for gnunet-service-gns_interceptor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int GNS_interceptor_init (const struct GNUNET_CONFIGURATION_Handle *c)
 Initialize DNS interceptor. More...
 
void GNS_interceptor_done (void)
 Stops the interceptor. More...
 

Detailed Description

GNUnet GNS service.

Author
Martin Schanzenbach

Definition in file gnunet-service-gns_interceptor.h.

Function Documentation

◆ GNS_interceptor_init()

int GNS_interceptor_init ( const struct GNUNET_CONFIGURATION_Handle c)

Initialize DNS interceptor.

Parameters
cthe configuration
Returns
GNUNET_YES on success GNUNET_SYSERR on error

Definition at line 386 of file gnunet-service-gns_interceptor.c.

387{
389 "DNS hijacking enabled. Connecting to DNS service.\n");
393 NULL);
394 if (NULL == dns_handle)
395 {
397 _ ("Failed to connect to the DNS service!\n"));
398 return GNUNET_SYSERR;
399 }
400 return GNUNET_YES;
401}
static void handle_dns_request(void *cls, struct GNUNET_DNS_RequestHandle *rh, size_t request_length, const char *request)
The DNS request handler.
static struct GNUNET_DNS_Handle * dns_handle
Our handle to the DNS handler library.
struct GNUNET_DNS_Handle * GNUNET_DNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_DNS_Flags flags, GNUNET_DNS_RequestHandler rh, void *rh_cls)
Connect to the service-dns.
Definition: dns_api.c:340
@ GNUNET_DNS_FLAG_PRE_RESOLUTION
This client should be called on requests that have not yet been resolved as this client provides a re...
#define GNUNET_log(kind,...)
@ GNUNET_YES
@ GNUNET_SYSERR
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_INFO
#define _(String)
GNU gettext support macro.
Definition: platform.h:178

References _, dns_handle, GNUNET_DNS_connect(), GNUNET_DNS_FLAG_PRE_RESOLUTION, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SYSERR, GNUNET_YES, and handle_dns_request().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNS_interceptor_done()

void GNS_interceptor_done ( void  )

Stops the interceptor.

Stops the interceptor.

Definition at line 408 of file gnunet-service-gns_interceptor.c.

409{
410 struct InterceptLookupHandle *ilh;
411
412 while (NULL != (ilh = ilh_head))
413 {
415 ilh_tail,
416 ilh);
420 GNUNET_free (ilh);
421 }
422 if (NULL != dns_handle)
423 {
425 dns_handle = NULL;
426 }
427}
static struct InterceptLookupHandle * ilh_head
Head of the DLL.
static struct InterceptLookupHandle * ilh_tail
Tail of the DLL.
void GNS_resolver_lookup_cancel(struct GNS_ResolverHandle *rh)
Cancel active resolution (i.e.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
void GNUNET_DNSPARSER_free_packet(struct GNUNET_DNSPARSER_Packet *p)
Free memory taken by a packet.
Definition: dnsparser.c:950
void GNUNET_DNS_disconnect(struct GNUNET_DNS_Handle *dh)
Disconnect from the DNS service.
Definition: dns_api.c:363
void GNUNET_DNS_request_drop(struct GNUNET_DNS_RequestHandle *rh)
If a GNUNET_DNS_RequestHandler calls this function, the request is to be dropped and no response shou...
Definition: dns_api.c:265
#define GNUNET_free(ptr)
Wrapper around free.
Handle to a DNS intercepted resolution request.
struct GNUNET_DNSPARSER_Packet * packet
the dns parser packet received
struct GNS_ResolverHandle * lookup
Handle for the lookup operation.
struct GNUNET_DNS_RequestHandle * request_handle
the request handle to reply to

References dns_handle, GNS_resolver_lookup_cancel(), GNUNET_CONTAINER_DLL_remove, GNUNET_DNS_disconnect(), GNUNET_DNS_request_drop(), GNUNET_DNSPARSER_free_packet(), GNUNET_free, ilh_head, ilh_tail, InterceptLookupHandle::lookup, InterceptLookupHandle::packet, and InterceptLookupHandle::request_handle.

Referenced by shutdown_task().

Here is the call graph for this function:
Here is the caller graph for this function: