GNUnet  0.11.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 375 of file gnunet-service-gns_interceptor.c.


Referenced by run().

376 {
378  "DNS hijacking enabled. Connecting to DNS service.\n");
382  NULL);
383  if (NULL == dns_handle)
384  {
386  _ ("Failed to connect to the DNS service!\n"));
387  return GNUNET_SYSERR;
388  }
389  return GNUNET_YES;
390 }
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
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:346
#define GNUNET_log(kind,...)
This client should be called on requests that have not yet been resolved as this client provides a re...
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 397 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().

398 {
399  struct InterceptLookupHandle *ilh;
401  while (NULL != (ilh = ilh_head))
402  {
404  ilh_tail,
405  ilh);
409  GNUNET_free (ilh);
410  }
411  if (NULL != dns_handle)
412  {
414  dns_handle = NULL;
415  }
416 }
#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: