GNUnet  0.10.x
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.


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.

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.

cthe configuration
GNUNET_YES on success GNUNET_SYSERR on error

Initialize DNS interceptor.

cthe configuration
GNUNET_OK on success

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


Referenced by run().

361 {
363  "DNS hijacking enabled. Connecting to DNS service.\n");
367  NULL);
368  if (NULL == dns_handle)
369  {
371  _("Failed to connect to the DNS service!\n"));
372  return GNUNET_SYSERR;
373  }
374  return GNUNET_YES;
375 }
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
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.
Definition: gnunet_common.h:76
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:345
#define GNUNET_log(kind,...)
This client should be called on requests that have not yet been resolved as this client provides a re...
#define GNUNET_YES
Definition: gnunet_common.h:77
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 382 of file gnunet-service-gns_interceptor.c.

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

Referenced by shutdown_task().

383 {
384  struct InterceptLookupHandle *ilh;
386  while (NULL != (ilh = ilh_head))
387  {
389  ilh_tail,
390  ilh);
394  GNUNET_free(ilh);
395  }
396  if (NULL != dns_handle)
397  {
399  dns_handle = NULL;
400  }
401 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
void GNS_resolver_lookup_cancel(struct GNS_ResolverHandle *rh)
Cancel active resolution (i.e.
struct GNUNET_DNSPARSER_Packet * packet
the dns parser packet received
static struct InterceptLookupHandle * ilh_tail
Tail of the DLL.
Handle to a DNS intercepted reslution request.
void GNUNET_DNSPARSER_free_packet(struct GNUNET_DNSPARSER_Packet *p)
Free memory taken by a packet.
Definition: dnsparser.c:853
void GNUNET_DNS_disconnect(struct GNUNET_DNS_Handle *dh)
Disconnect from the DNS service.
Definition: dns_api.c:368
struct GNS_ResolverHandle * lookup
Handle for the lookup operation.
static struct InterceptLookupHandle * ilh_head
Head of the DLL.
static struct GNUNET_DNS_Handle * dns_handle
Our handle to the DNS handler library.
struct GNUNET_DNS_RequestHandle * request_handle
the request handle to reply to
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:270
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function: