GNUnet  0.11.x
Functions
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

Initialize DNS interceptor.

Parameters
cthe configuration
Returns
GNUNET_OK on success

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

References _, 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().

370 {
372  "DNS hijacking enabled. Connecting to DNS service.\n");
376  NULL);
377  if (NULL == dns_handle)
378  {
380  _ ("Failed to connect to the DNS service!\n"));
381  return GNUNET_SYSERR;
382  }
383  return GNUNET_YES;
384 }
#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.
#define GNUNET_SYSERR
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:346
#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 391 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().

392 {
393  struct InterceptLookupHandle *ilh;
394 
395  while (NULL != (ilh = ilh_head))
396  {
398  ilh_tail,
399  ilh);
403  GNUNET_free (ilh);
404  }
405  if (NULL != dns_handle)
406  {
408  dns_handle = NULL;
409  }
410 }
#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:854
void GNUNET_DNS_disconnect(struct GNUNET_DNS_Handle *dh)
Disconnect from the DNS service.
Definition: dns_api.c:369
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:271
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function: