GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
gnunet-gns-helper-service-w32.c File Reference

an intermediary service to access distributed GNS More...

#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_identity_service.h>
#include <gnunet_dnsparser_lib.h>
#include <gnunet_namestore_service.h>
#include <gnunet_gns_service.h>
#include <initguid.h>
#include "gnunet_w32nsp_lib.h"
#include "w32resolver.h"
#include <nspapi.h>
#include <unistr.h>
Include dependency graph for gnunet-gns-helper-service-w32.c:

Go to the source code of this file.

Data Structures

struct  request
 

Macros

#define DEFINE_DNS_GUID(a, x)   DEFINE_GUID(a, 0x00090035, 0x0000, x, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
#define MarshallPtr(ptr, base, type)
 

Functions

 DEFINE_GUID (SVCID_DNS_TYPE_A, 0x00090035, 0x0000, 0x0001, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_NS, 0x00090035, 0x0000, 0x0002, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_CNAME, 0x00090035, 0x0000, 0x0005, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_SOA, 0x00090035, 0x0000, 0x0006, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_PTR, 0x00090035, 0x0000, 0x000c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_MX, 0x00090035, 0x0000, 0x000f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_TEXT, 0x00090035, 0x0000, 0x0010, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_AAAA, 0x00090035, 0x0000, 0x001c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_DNS_TYPE_SRV, 0x00090035, 0x0000, 0x0021, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_HOSTNAME, 0x0002a800, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (SVCID_INET_HOSTADDRBYNAME, 0x0002a803, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
static void do_shutdown (void *cls)
 Task run on shutdown. More...
 
void MarshallWSAQUERYSETW (WSAQUERYSETW *qs, GUID *sc)
 
static void process_lookup_result (void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void get_ip_from_hostname (struct GNUNET_SERVICE_Client *client, const wchar_t *name, int af, GUID sc)
 
static int check_get (void *cls, const struct GNUNET_W32RESOLVER_GetMessage *msg)
 Check GET-message. More...
 
static void handle_get (void *cls, const struct GNUNET_W32RESOLVER_GetMessage *msg)
 Handle GET-message. More...
 
static void identity_master_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
 Method called to with the ego we are to use for the lookup, when the ego is the one for the default master zone. More...
 
static void run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
 Start up gns-helper-w32 service. More...
 
static void * client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
 Handle client connecting to the service. More...
 
static void client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls)
 Callback called when a client disconnected from the service. More...
 
 GNUNET_SERVICE_MAIN ("gns-helper-service-w32", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size(get, 4, struct GNUNET_W32RESOLVER_GetMessage, NULL), GNUNET_MQ_handler_end())
 Define "main" method using service macro. More...
 

Variables

static struct requestrq_head
 Head of the doubly-linked list (for cleanup). More...
 
static struct requestrq_tail
 Tail of the doubly-linked list (for cleanup). More...
 
static struct GNUNET_GNS_Handlegns
 Handle to GNS service. More...
 
static struct GNUNET_IDENTITY_Operationid_op
 Active operation on identity service. More...
 
static struct GNUNET_IDENTITY_Handleidentity
 Handle for identity service. More...
 
static struct GNUNET_CRYPTO_EcdsaPublicKey gns_master_pubkey
 Public key of the gns-master ego. More...
 
static int got_egos
 Set to 1 once egos are obtained. More...
 

Detailed Description

an intermediary service to access distributed GNS

Author
Christian Grothoff
LRN

Definition in file gnunet-gns-helper-service-w32.c.

Macro Definition Documentation

◆ DEFINE_DNS_GUID

#define DEFINE_DNS_GUID (   a,
 
)    DEFINE_GUID(a, 0x00090035, 0x0000, x, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)

Definition at line 38 of file gnunet-gns-helper-service-w32.c.

◆ MarshallPtr

#define MarshallPtr (   ptr,
  base,
  type 
)
Value:
if (ptr) \
ptr = (type *) ((char *) ptr - (char *) base)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model

Definition at line 157 of file gnunet-gns-helper-service-w32.c.

Referenced by MarshallWSAQUERYSETW().

Function Documentation

◆ DEFINE_GUID() [1/11]

DEFINE_GUID ( SVCID_DNS_TYPE_A  ,
0x00090035  ,
0x0000  ,
0x0001  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [2/11]

DEFINE_GUID ( SVCID_DNS_TYPE_NS  ,
0x00090035  ,
0x0000  ,
0x0002  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [3/11]

DEFINE_GUID ( SVCID_DNS_TYPE_CNAME  ,
0x00090035  ,
0x0000  ,
0x0005  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [4/11]

DEFINE_GUID ( SVCID_DNS_TYPE_SOA  ,
0x00090035  ,
0x0000  ,
0x0006  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [5/11]

DEFINE_GUID ( SVCID_DNS_TYPE_PTR  ,
0x00090035  ,
0x0000  ,
0x000c  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [6/11]

DEFINE_GUID ( SVCID_DNS_TYPE_MX  ,
0x00090035  ,
0x0000  ,
0x000f  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [7/11]

DEFINE_GUID ( SVCID_DNS_TYPE_TEXT  ,
0x00090035  ,
0x0000  ,
0x0010  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [8/11]

DEFINE_GUID ( SVCID_DNS_TYPE_AAAA  ,
0x00090035  ,
0x0000  ,
0x001c  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [9/11]

DEFINE_GUID ( SVCID_DNS_TYPE_SRV  ,
0x00090035  ,
0x0000  ,
0x0021  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [10/11]

DEFINE_GUID ( SVCID_HOSTNAME  ,
0x0002a800  ,
0x0000  ,
0x0000  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ DEFINE_GUID() [11/11]

DEFINE_GUID ( SVCID_INET_HOSTADDRBYNAME  ,
0x0002a803  ,
0x0000  ,
0x0000  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Task run on shutdown.

Cleans up everything.

Parameters
clsunused

Definition at line 123 of file gnunet-gns-helper-service-w32.c.

References GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_free_non_null, GNUNET_GNS_disconnect(), GNUNET_GNS_lookup_cancel(), GNUNET_IDENTITY_cancel(), GNUNET_IDENTITY_disconnect(), request::lookup_request, request::name, and request::u8name.

Referenced by run().

124 {
125  struct request *rq;
126 
127  if (NULL != id_op)
128  {
130  id_op = NULL;
131  }
132  if (NULL != identity)
133  {
135  identity = NULL;
136  }
137  while (NULL != (rq = rq_head))
138  {
139  if (NULL != rq->lookup_request)
142  rq_tail,
143  rq);
145  if (rq->u8name)
146  free (rq->u8name);
147  GNUNET_free (rq);
148  }
149  if (NULL != gns)
150  {
152  gns = NULL;
153  }
154 }
static struct request * rq_tail
Tail of the doubly-linked list (for cleanup).
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
void GNUNET_IDENTITY_cancel(struct GNUNET_IDENTITY_Operation *op)
Cancel an identity operation.
Definition: identity_api.c:819
static struct GNUNET_IDENTITY_Operation * id_op
Active operation on identity service.
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
Definition: gns_api.c:285
static struct request * rq_head
Head of the doubly-linked list (for cleanup).
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:838
static struct GNUNET_IDENTITY_Handle * identity
Handle for identity service.
void * GNUNET_GNS_lookup_cancel(struct GNUNET_GNS_LookupRequest *lr)
Cancel pending lookup request.
Definition: gns_api.c:309
struct GNUNET_GNS_LookupRequest * lookup_request
static struct GNUNET_GNS_Handle * gns
Handle to GNS service.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MarshallWSAQUERYSETW()

void MarshallWSAQUERYSETW ( WSAQUERYSETW *  qs,
GUID *  sc 
)

Definition at line 163 of file gnunet-gns-helper-service-w32.c.

References MarshallPtr.

Referenced by process_lookup_result().

164 {
165  MarshallPtr (qs->lpszServiceInstanceName, qs, wchar_t);
166  MarshallPtr (qs->lpServiceClassId, qs, GUID);
167  MarshallPtr (qs->lpVersion, qs, WSAVERSION);
168  MarshallPtr (qs->lpNSProviderId, qs, GUID);
169  MarshallPtr (qs->lpszContext, qs, wchar_t);
170  MarshallPtr (qs->lpafpProtocols, qs, AFPROTOCOLS);
171  MarshallPtr (qs->lpszQueryString, qs, wchar_t);
172  for (int i = 0; i < qs->dwNumberOfCsAddrs; i++)
173  {
174  MarshallPtr (qs->lpcsaBuffer[i].LocalAddr.lpSockaddr, qs, SOCKADDR);
175  MarshallPtr (qs->lpcsaBuffer[i].RemoteAddr.lpSockaddr, qs, SOCKADDR);
176  }
177  MarshallPtr (qs->lpcsaBuffer, qs, CSADDR_INFO);
178  if (IsEqualGUID (&SVCID_INET_HOSTADDRBYNAME, sc) && qs->lpBlob != NULL && qs->lpBlob->pBlobData != NULL)
179  {
180  struct hostent *he;
181 
182  he = (struct hostent *) qs->lpBlob->pBlobData;
183  for (int i = 0; he->h_aliases[i] != NULL; i++)
184  MarshallPtr (he->h_aliases[i], he, char);
185  MarshallPtr (he->h_aliases, he, char *);
186  MarshallPtr (he->h_name, he, char);
187  for (int i = 0; he->h_addr_list[i] != NULL; i++)
188  MarshallPtr (he->h_addr_list[i], he, void);
189  MarshallPtr (he->h_addr_list, he, char *);
190  MarshallPtr (qs->lpBlob->pBlobData, qs, void);
191  }
192  MarshallPtr (qs->lpBlob, qs, BLOB);
193 }
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
#define MarshallPtr(ptr, base, type)
Here is the caller graph for this function:

◆ process_lookup_result()

static void process_lookup_result ( void *  cls,
uint32_t  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Definition at line 197 of file gnunet-gns-helper-service-w32.c.

References GNUNET_W32RESOLVER_GetMessage::af, request::af, request::client, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_DNSPARSER_TYPE_A, GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_free_non_null, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_W32RESOLVER_RESPONSE, GNUNET_MQ_msg, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_SERVICE_client_get_mq(), request::lookup_request, MarshallWSAQUERYSETW(), msg, request::name, GNUNET_GNSRECORD_Data::record_type, request::sc, GNUNET_W32RESOLVER_GetMessage::sc_data1, GNUNET_W32RESOLVER_GetMessage::sc_data2, GNUNET_W32RESOLVER_GetMessage::sc_data3, GNUNET_W32RESOLVER_GetMessage::sc_data4, size, and request::u8name.

Referenced by get_ip_from_hostname().

200 {
201  struct request *rq = cls;
202  int i, j, csanum;
204  struct GNUNET_MQ_Envelope *msg_env;
205  struct GNUNET_MessageHeader *msgend;
206  struct GNUNET_MQ_Envelope *msgend_env;
207  WSAQUERYSETW *qs;
208  size_t size;
209  size_t size_recalc;
210  char *ptr;
211  size_t blobsize = 0;
212  size_t blobaddrcount = 0;
213 
215  "Got lookup result with count %u for rq %p with client %p\n",
216  rd_count,
217  rq,
218  rq->client);
219  rq->lookup_request = NULL;
220 
221  if (0 == rd_count)
222  {
225  msgend_env);
227  rq_tail,
228  rq);
230  if (rq->u8name)
231  free (rq->u8name);
232  GNUNET_free (rq);
233  return;
234  }
235 
236  size = sizeof (struct GNUNET_W32RESOLVER_GetMessage) + sizeof (WSAQUERYSETW);
237  size += (wcslen (rq->name) + 1) * sizeof (wchar_t);
238  size += sizeof (GUID);
239  /* lpszComment ? a TXT record? */
240  size += sizeof (GUID);
241  /* lpszContext ? Not sure what it is */
242  csanum = 0;
243  for (i = 0; i < rd_count; i++)
244  {
245  switch (rd[i].record_type)
246  {
248  if (rd[i].data_size != sizeof (struct in_addr))
249  continue;
250  size += sizeof (CSADDR_INFO) + sizeof (struct sockaddr_in) * 2;
251  csanum++;
252  break;
254  if (rd[i].data_size != sizeof (struct in6_addr))
255  continue;
256  size += sizeof (CSADDR_INFO) + sizeof (struct sockaddr_in6) * 2;
257  csanum++;
258  break;
259  }
260  }
261  if (IsEqualGUID (&SVCID_INET_HOSTADDRBYNAME, &rq->sc))
262  {
263  size += sizeof (BLOB);
264  blobsize += sizeof (struct hostent);
265  blobsize += strlen (rq->u8name) + 1;
266  blobsize += sizeof (void *); /* For aliases */
267  blobsize += sizeof (void *); /* For addresses */
268  for (i = 0; i < rd_count; i++)
269  {
270  if ((rq->af == AF_INET || rq->af == AF_UNSPEC) && rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
271  {
272  blobsize += sizeof (void *);
273  blobsize += sizeof (struct in_addr);
274  blobaddrcount++;
275  }
276  else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_DNSPARSER_TYPE_AAAA)
277  {
278  blobsize += sizeof (void *);
279  blobsize += sizeof (struct in6_addr);
280  blobaddrcount++;
281  }
282  }
283  size += blobsize;
284  }
285  size_recalc = sizeof (struct GNUNET_W32RESOLVER_GetMessage) + sizeof (WSAQUERYSETW);
286  msg_env = GNUNET_MQ_msg_extra (msg,
287  size - sizeof (struct GNUNET_MessageHeader),
289  msg->af = htonl (rq->af);
290  msg->sc_data1 = htonl (rq->sc.Data1);
291  msg->sc_data2 = htons (rq->sc.Data2);
292  msg->sc_data3 = htons (rq->sc.Data3);
293  for (i = 0; i < 8; i++)
294  msg->sc_data4[i] = rq->sc.Data4[i];
295  qs = (WSAQUERYSETW *) &msg[1];
296  ptr = (char *) &qs[1];
297  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
298  qs->dwSize = sizeof (WSAQUERYSETW);
299  qs->lpszServiceInstanceName = (wchar_t *) ptr;
300  ptr += (wcslen (rq->name) + 1) * sizeof (wchar_t);
301  size_recalc += (wcslen (rq->name) + 1) * sizeof (wchar_t);
302  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
303  wcscpy (qs->lpszServiceInstanceName, rq->name);
304  qs->lpServiceClassId = (GUID *) ptr;
305  ptr += sizeof (GUID);
306  size_recalc += sizeof (GUID);
307  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
308  GNUNET_memcpy (qs->lpServiceClassId, &rq->sc, sizeof (GUID));
309  qs->lpVersion = NULL;
310  qs->dwNameSpace = NS_DNS;
311  qs->lpNSProviderId = (GUID *) ptr;
312  ptr += sizeof (GUID);
313  size_recalc += sizeof (GUID);
314  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
315  GNUNET_memcpy (qs->lpNSProviderId, &GNUNET_NAMESPACE_PROVIDER_DNS, sizeof (GUID));
316  qs->lpszContext = NULL;
317  qs->dwNumberOfProtocols = 0;
318  qs->lpafpProtocols = NULL;
319  /* Don't bother with this... */
320  qs->lpszQueryString = NULL;
321  qs->dwNumberOfCsAddrs = rd_count;
322  qs->lpcsaBuffer = (CSADDR_INFO *) ptr;
323  ptr += sizeof (CSADDR_INFO) * csanum;
324  j = 0;
325  for (i = 0; i < rd_count; i++)
326  {
327  switch (rd[i].record_type)
328  {
330  if (rd[i].data_size != sizeof (struct in_addr))
331  continue;
332  qs->lpcsaBuffer[j].iSocketType = SOCK_STREAM;
333  qs->lpcsaBuffer[j].iProtocol = IPPROTO_TCP;
334 
335  qs->lpcsaBuffer[j].LocalAddr.iSockaddrLength = sizeof (struct sockaddr_in);
336  qs->lpcsaBuffer[j].LocalAddr.lpSockaddr = (SOCKADDR *) ptr;
337  ptr += qs->lpcsaBuffer[j].LocalAddr.iSockaddrLength;
338  memset (qs->lpcsaBuffer[j].LocalAddr.lpSockaddr, 0, qs->lpcsaBuffer[j].LocalAddr.iSockaddrLength);
339  ((struct sockaddr_in *)qs->lpcsaBuffer[j].LocalAddr.lpSockaddr)->sin_family = AF_INET;
340 
341  qs->lpcsaBuffer[j].RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_in);
342  qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr = (SOCKADDR *) ptr;
343  ptr += qs->lpcsaBuffer[j].RemoteAddr.iSockaddrLength;
344  memset (qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr, 0, qs->lpcsaBuffer[j].RemoteAddr.iSockaddrLength);
345  ((struct sockaddr_in *)qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr)->sin_family = AF_INET;
346  ((struct sockaddr_in *)qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr)->sin_port = htonl (53); /* Don't ask why it's 53 */
347  ((struct sockaddr_in *)qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr)->sin_addr = *(struct in_addr *) rd[i].data;
348  size_recalc += sizeof (CSADDR_INFO) + sizeof (struct sockaddr_in) * 2;
349  j++;
350  break;
352  if (rd[i].data_size != sizeof (struct in6_addr))
353  continue;
354  qs->lpcsaBuffer[j].iSocketType = SOCK_STREAM;
355  qs->lpcsaBuffer[j].iProtocol = IPPROTO_TCP;
356 
357  qs->lpcsaBuffer[j].LocalAddr.iSockaddrLength = sizeof (struct sockaddr_in6);
358  qs->lpcsaBuffer[j].LocalAddr.lpSockaddr = (SOCKADDR *) ptr;
359  ptr += qs->lpcsaBuffer[j].LocalAddr.iSockaddrLength;
360  memset (qs->lpcsaBuffer[j].LocalAddr.lpSockaddr, 0, qs->lpcsaBuffer[j].LocalAddr.iSockaddrLength);
361  ((struct sockaddr_in6 *)qs->lpcsaBuffer[j].LocalAddr.lpSockaddr)->sin6_family = AF_INET6;
362 
363  qs->lpcsaBuffer[j].RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_in6);
364  qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr = (SOCKADDR *) ptr;
365  ptr += qs->lpcsaBuffer[j].RemoteAddr.iSockaddrLength;
366  memset (qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr, 0, qs->lpcsaBuffer[j].RemoteAddr.iSockaddrLength);
367  ((struct sockaddr_in6 *)qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr)->sin6_family = AF_INET6;
368  ((struct sockaddr_in6 *)qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr)->sin6_port = htonl (53); /* Don't ask why it's 53 */
369  ((struct sockaddr_in6 *)qs->lpcsaBuffer[j].RemoteAddr.lpSockaddr)->sin6_addr = *(struct in6_addr *) rd[i].data;
370  size_recalc += sizeof (CSADDR_INFO) + sizeof (struct sockaddr_in6) * 2;
371  j++;
372  break;
373  default:
374  break;
375  }
376  }
377  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
378  qs->dwOutputFlags = 0;
379  if (IsEqualGUID (&SVCID_INET_HOSTADDRBYNAME, &rq->sc))
380  {
381  struct hostent *he;
382  qs->lpBlob = (BLOB *) ptr;
383  ptr += sizeof (BLOB);
384 
385  size_recalc += sizeof (BLOB);
386  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
387 
388  qs->lpBlob->cbSize = blobsize;
389  qs->lpBlob->pBlobData = (BYTE *) ptr;
390  ptr += sizeof (struct hostent);
391 
392  size_recalc += sizeof (struct hostent);
393  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
394 
395  he = (struct hostent *) qs->lpBlob->pBlobData;
396  he->h_name = (char *) ptr;
397  ptr += strlen (rq->u8name) + 1;
398 
399  size_recalc += strlen (rq->u8name) + 1;
400  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
401 
402  strcpy (he->h_name, rq->u8name);
403  he->h_aliases = (char **) ptr;
404  ptr += sizeof (void *);
405 
406  size_recalc += sizeof (void *); /* For aliases */
407  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
408 
409  he->h_aliases[0] = NULL;
410  he->h_addrtype = rq->af;
411  he->h_length = rq->af == AF_INET || rq->af == AF_UNSPEC ? sizeof (struct in_addr) : sizeof (struct in6_addr);
412  he->h_addr_list = (char **) ptr;
413  ptr += sizeof (void *) * (blobaddrcount + 1);
414 
415  size_recalc += sizeof (void *) * (blobaddrcount + 1); /* For addresses */
416  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
417 
418  j = 0;
419  for (i = 0; i < rd_count; i++)
420  {
421  if ((rq->af == AF_INET || rq->af == AF_UNSPEC) &&
422  rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
423  {
424  he->h_addr_list[j] = (char *) ptr;
425  ptr += sizeof (struct in_addr);
426 
427  size_recalc += sizeof (struct in_addr);
428  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
429 
430  GNUNET_memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in_addr));
431  j++;
432  }
433  else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_DNSPARSER_TYPE_AAAA)
434  {
435  he->h_addr_list[j] = (char *) ptr;
436  ptr += sizeof (struct in6_addr);
437 
438  size_recalc += sizeof (struct in6_addr);
439  GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
440 
441  GNUNET_memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in6_addr));
442  j++;
443  }
444  }
445  he->h_addr_list[j] = NULL;
446  }
448 
449  if ((char *) ptr - (char *) msg != size || size_recalc != size || size_recalc != ((char *) ptr - (char *) msg))
450  {
452  "Error in WSAQUERYSETW size calc: expected %u, got %lu (recalc %u)\n",
453  size,
454  (unsigned long) ((char *) ptr - (char *) msg),
455  size_recalc);
456  }
457  MarshallWSAQUERYSETW (qs, &rq->sc);
459  msg_env);
461  msgend_env);
463  rq_tail,
464  rq);
466  if (rq->u8name)
467  free (rq->u8name);
468  GNUNET_free (rq);
469 }
static struct request * rq_tail
Tail of the doubly-linked list (for cleanup).
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2734
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
void MarshallWSAQUERYSETW(WSAQUERYSETW *qs, GUID *sc)
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
#define GNUNET_memcpy(dst, src, n)
const void * data
Binary value stored in the DNS record.
Request for the resolver.
Definition: w32resolver.h:53
static struct request * rq_head
Head of the doubly-linked list (for cleanup).
struct GNUNET_SERVICE_Client * client
Client that issued the request.
static unsigned int size
Size of the "table".
Definition: peer.c:67
uint32_t record_type
Type of the GNS/DNS record.
#define GNUNET_DNSPARSER_TYPE_AAAA
#define GNUNET_log(kind,...)
Header for all communications.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_GNS_LookupRequest * lookup_request
#define GNUNET_MESSAGE_TYPE_W32RESOLVER_RESPONSE
Response to a DNS resolution request.
Definition: w32resolver.h:40
uint32_t data
The data value.
static size_t data_size
Number of bytes in data.
#define GNUNET_DNSPARSER_TYPE_A
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_ip_from_hostname()

static void get_ip_from_hostname ( struct GNUNET_SERVICE_Client client,
const wchar_t *  name,
int  af,
GUID  sc 
)
static

Definition at line 473 of file gnunet-gns-helper-service-w32.c.

References request::af, request::client, gns_master_pubkey, GNUNET_CONTAINER_DLL_insert, GNUNET_DNSPARSER_TYPE_A, GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_DNSPARSER_TYPE_CNAME, GNUNET_DNSPARSER_TYPE_MX, GNUNET_DNSPARSER_TYPE_NS, GNUNET_DNSPARSER_TYPE_PTR, GNUNET_DNSPARSER_TYPE_SOA, GNUNET_DNSPARSER_TYPE_SRV, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_free_non_null, GNUNET_GNS_lookup(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), hostname, request::lookup_request, request::name, process_lookup_result(), rtype, request::sc, and request::u8name.

Referenced by handle_get().

477 {
478  struct request *rq;
479  char *hostname;
480  size_t strl;
481  size_t namelen;
482  uint32_t rtype;
483 
484  if (IsEqualGUID (&SVCID_DNS_TYPE_A, &sc))
485  rtype = GNUNET_DNSPARSER_TYPE_A;
486  else if (IsEqualGUID (&SVCID_DNS_TYPE_NS, &sc))
487  rtype = GNUNET_DNSPARSER_TYPE_NS;
488  else if (IsEqualGUID (&SVCID_DNS_TYPE_CNAME, &sc))
490  else if (IsEqualGUID (&SVCID_DNS_TYPE_SOA, &sc))
492  else if (IsEqualGUID (&SVCID_DNS_TYPE_PTR, &sc))
494  else if (IsEqualGUID (&SVCID_DNS_TYPE_MX, &sc))
495  rtype = GNUNET_DNSPARSER_TYPE_MX;
496  else if (IsEqualGUID (&SVCID_DNS_TYPE_TEXT, &sc))
498  else if (IsEqualGUID (&SVCID_DNS_TYPE_AAAA, &sc))
500  else if (IsEqualGUID (&SVCID_DNS_TYPE_SRV, &sc))
502  else if (IsEqualGUID (&SVCID_INET_HOSTADDRBYNAME, &sc))
503  rtype = GNUNET_DNSPARSER_TYPE_A;
504  else
505  {
507  "Unknown GUID: %08lX-%04X-%04X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
508  sc.Data1,
509  sc.Data2,
510  sc.Data3,
511  sc.Data4[0],
512  sc.Data4[1],
513  sc.Data4[2],
514  sc.Data4[3],
515  sc.Data4[4],
516  sc.Data4[5],
517  sc.Data4[6],
518  sc.Data4[7]);
520  return;
521  }
522 
523  if (name)
524  namelen = wcslen (name);
525  else
526  namelen = 0;
527  if (namelen > 0)
528  hostname = (char *) u16_to_u8 (name, namelen + 1, NULL, &strl);
529  else
530  hostname = NULL;
531 
533  "W32 DNS resolver asked to look up %s for `%s'.\n",
534  af == AF_INET ? "IPv4" : af == AF_INET6 ? "IPv6" : "anything",
535  hostname);
536 
537  rq = GNUNET_new (struct request);
538  rq->sc = sc;
539  rq->client = client;
540  rq->af = af;
541  if (rq->af != AF_INET && rq->af != AF_INET6)
542  rq->af = AF_INET;
543  if (namelen)
544  {
545  rq->name = GNUNET_malloc ((namelen + 1) * sizeof (wchar_t));
546  GNUNET_memcpy (rq->name,
547  name,
548  (namelen + 1) * sizeof (wchar_t));
549  rq->u8name = hostname;
550  }
551 
553  "Launching a lookup for client %p with rq %p\n",
554  client,
555  rq);
557  hostname,
559  rtype,
560  GNUNET_NO /* Use DHT */,
562  rq);
563  if (NULL != rq->lookup_request)
564  {
566  "Lookup launched, waiting for a reply\n");
569  rq_tail,
570  rq);
571  }
572  else
573  {
575  "Lookup was not launched, disconnecting the client\n");
577  if (rq->u8name)
578  free (rq->u8name);
579  GNUNET_free (rq);
581  }
582 }
static struct request * rq_tail
Tail of the doubly-linked list (for cleanup).
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_DNSPARSER_TYPE_CNAME
static struct GNUNET_CRYPTO_EcdsaPublicKey gns_master_pubkey
Public key of the gns-master ego.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_DNSPARSER_TYPE_MX
static void process_lookup_result(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
#define GNUNET_DNSPARSER_TYPE_PTR
#define GNUNET_DNSPARSER_TYPE_SOA
#define GNUNET_memcpy(dst, src, n)
static struct request * rq_head
Head of the doubly-linked list (for cleanup).
struct GNUNET_SERVICE_Client * client
Client that issued the request.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2618
#define GNUNET_DNSPARSER_TYPE_TXT
const char * name
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
static char * hostname
Our hostname; we give this to all the peers we start.
#define GNUNET_DNSPARSER_TYPE_AAAA
#define GNUNET_DNSPARSER_TYPE_NS
#define GNUNET_log(kind,...)
struct GNUNET_GNS_LookupRequest * lookup_request
static struct GNUNET_GNS_Handle * gns
Handle to GNS service.
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS.
Definition: gns_api.c:337
#define GNUNET_DNSPARSER_TYPE_SRV
static uint32_t rtype
Desired record type.
Definition: gnunet-gns.c:60
#define GNUNET_DNSPARSER_TYPE_A
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_get()

static int check_get ( void *  cls,
const struct GNUNET_W32RESOLVER_GetMessage msg 
)
static

Check GET-message.

Parameters
clsidentification of the client
msgthe actual message
Returns
GNUNET_OK if msg is well-formed

Definition at line 593 of file gnunet-gns-helper-service-w32.c.

References _, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, got_egos, GNUNET_W32RESOLVER_GetMessage::header, hostname, size, and GNUNET_MessageHeader::size.

595 {
596  uint16_t size;
597  const wchar_t *hostname;
598 
599  if (! got_egos)
600  {
602  _("Not ready to process requests, lacking ego data\n"));
603  return GNUNET_SYSERR;
604  }
605  size = ntohs (msg->header.size) - sizeof (struct GNUNET_W32RESOLVER_GetMessage);
606  hostname = (const wchar_t *) &msg[1];
607  if (hostname[size / 2 - 1] != L'\0')
608  {
609  GNUNET_break (0);
610  return GNUNET_SYSERR;
611  }
612  return GNUNET_OK;
613 }
static int got_egos
Set to 1 once egos are obtained.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
Request for the resolver.
Definition: w32resolver.h:53
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static unsigned int size
Size of the "table".
Definition: peer.c:67
static char * hostname
Our hostname; we give this to all the peers we start.
#define GNUNET_log(kind,...)
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_W32RESOLVER_REQUEST.
Definition: w32resolver.h:58

◆ handle_get()

static void handle_get ( void *  cls,
const struct GNUNET_W32RESOLVER_GetMessage msg 
)
static

Handle GET-message.

Parameters
clsidentification of the client
msgthe actual message

Definition at line 623 of file gnunet-gns-helper-service-w32.c.

References GNUNET_W32RESOLVER_GetMessage::af, request::af, request::client, get_ip_from_hostname(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_W32RESOLVER_GetMessage::header, hostname, request::sc, GNUNET_W32RESOLVER_GetMessage::sc_data1, GNUNET_W32RESOLVER_GetMessage::sc_data2, GNUNET_W32RESOLVER_GetMessage::sc_data3, GNUNET_W32RESOLVER_GetMessage::sc_data4, size, and GNUNET_MessageHeader::size.

625 {
626  struct GNUNET_SERVICE_Client *client = cls;
627  GUID sc;
628  uint16_t size;
629  const wchar_t *hostname;
630  int af;
631 
632  size = ntohs (msg->header.size) - sizeof (struct GNUNET_W32RESOLVER_GetMessage);
633  af = ntohl (msg->af);
635  "Got NBO GUID: %08X-%04X-%04X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
636  msg->sc_data1,
637  msg->sc_data2,
638  msg->sc_data3,
639  msg->sc_data4[0],
640  msg->sc_data4[1],
641  msg->sc_data4[2],
642  msg->sc_data4[3],
643  msg->sc_data4[4],
644  msg->sc_data4[5],
645  msg->sc_data4[6],
646  msg->sc_data4[7]);
647  sc.Data1 = ntohl (msg->sc_data1);
648  sc.Data2 = ntohs (msg->sc_data2);
649  sc.Data3 = ntohs (msg->sc_data3);
650  for (int i = 0; i < 8; i++)
651  sc.Data4[i] = msg->sc_data4[i];
653  "Got GUID: %08lX-%04X-%04X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
654  sc.Data1,
655  sc.Data2,
656  sc.Data3,
657  sc.Data4[0],
658  sc.Data4[1],
659  sc.Data4[2],
660  sc.Data4[3],
661  sc.Data4[4],
662  sc.Data4[5],
663  sc.Data4[6],
664  sc.Data4[7]);
665  hostname = (const wchar_t *) &msg[1];
667  "Name of %u bytes (last word is 0x%0X): %*S\n",
668  size,
669  hostname[size / 2 - 2],
670  size / 2,
671  hostname);
672  get_ip_from_hostname (client,
673  hostname,
674  af,
675  sc);
676 }
static void get_ip_from_hostname(struct GNUNET_SERVICE_Client *client, const wchar_t *name, int af, GUID sc)
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Handle to a client that is connected to a service.
Definition: service.c:249
Request for the resolver.
Definition: w32resolver.h:53
static unsigned int size
Size of the "table".
Definition: peer.c:67
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
static char * hostname
Our hostname; we give this to all the peers we start.
#define GNUNET_log(kind,...)
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_W32RESOLVER_REQUEST.
Definition: w32resolver.h:58
Here is the call graph for this function:

◆ identity_master_cb()

static void identity_master_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego,
void **  ctx,
const char *  name 
)
static

Method called to with the ego we are to use for the lookup, when the ego is the one for the default master zone.

Parameters
clsclosure (NULL, unused)
egoego handle, NULL if not found
ctxcontext for application to store data for this ego (during the lifetime of this process, initially NULL)
namename assigned by the user for this ego, NULL if the user just deleted the ego and it must thus no longer be used

Definition at line 692 of file gnunet-gns-helper-service-w32.c.

References _, gns_master_pubkey, GNUNET_ERROR_TYPE_ERROR, GNUNET_IDENTITY_ego_get_public_key(), GNUNET_log, GNUNET_SCHEDULER_shutdown(), and got_egos.

Referenced by run().

696 {
697  id_op = NULL;
698  if (NULL == ego)
699  {
701  _("Ego for `gns-master' not found, cannot perform lookup. Did you run gnunet-gns-import.sh?\n"));
703  return;
704  }
707  got_egos = 1;
708 }
static struct GNUNET_IDENTITY_Operation * id_op
Active operation on identity service.
static struct GNUNET_CRYPTO_EcdsaPublicKey gns_master_pubkey
Public key of the gns-master ego.
static int got_egos
Set to 1 once egos are obtained.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
void GNUNET_IDENTITY_ego_get_public_key(const struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
Get the identifier (public key) of an ego.
Definition: identity_api.c:569
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg,
struct GNUNET_SERVICE_Handle service 
)
static

Start up gns-helper-w32 service.

Parameters
clsclosure
cfgconfiguration to use
servicethe initialized service

Definition at line 719 of file gnunet-gns-helper-service-w32.c.

References _, do_shutdown(), GNUNET_assert, GNUNET_GNS_connect(), GNUNET_IDENTITY_connect(), GNUNET_IDENTITY_get(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), and identity_master_cb().

Referenced by client_disconnect_cb().

722 {
723  gns = GNUNET_GNS_connect (cfg);
724  if (NULL == gns)
725  {
726  fprintf (stderr,
727  _("Failed to connect to GNS\n"));
729  return;
730  }
732  NULL);
734  NULL,
735  NULL);
736  if (NULL == identity)
737  {
738  fprintf (stderr,
739  _("Failed to connect to identity service\n"));
741  return;
742  }
744  "gns-master",
746  NULL);
747  GNUNET_assert (NULL != id_op);
748 }
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
Definition: identity_api.c:528
static void identity_master_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
Method called to with the ego we are to use for the lookup, when the ego is the one for the default m...
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_IDENTITY_Operation * id_op
Active operation on identity service.
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_get(struct GNUNET_IDENTITY_Handle *h, const char *service_name, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Obtain the identity that is currently preferred/default for a service.
Definition: identity_api.c:587
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
Definition: gns_api.c:263
static void do_shutdown(void *cls)
Task run on shutdown.
static struct GNUNET_IDENTITY_Handle * identity
Handle for identity service.
static struct GNUNET_GNS_Handle * gns
Handle to GNS service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_connect_cb()

static void* client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
struct GNUNET_MQ_Handle mq 
)
static

Handle client connecting to the service.

Parameters
clsNULL
clientthe new client
mqthe message queue of client
Returns
client

Definition at line 760 of file gnunet-gns-helper-service-w32.c.

References request::client.

Referenced by client_disconnect_cb().

763 {
764  return client;
765 }
Here is the caller graph for this function:

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
void *  internal_cls 
)
static

Callback called when a client disconnected from the service.

Parameters
clsclosure for the service
cthe client that disconnected
internal_clsshould be equal to c

Definition at line 776 of file gnunet-gns-helper-service-w32.c.

References client_connect_cb(), GNUNET_assert, GNUNET_MESSAGE_TYPE_W32RESOLVER_REQUEST, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_SERVICE_MAIN(), GNUNET_SERVICE_OPTION_NONE, and run().

779 {
780  GNUNET_assert (internal_cls == client);
781 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Here is the call graph for this function:

◆ GNUNET_SERVICE_MAIN()

GNUNET_SERVICE_MAIN ( "gns-helper-service-w32"  ,
GNUNET_SERVICE_OPTION_NONE  ,
run,
client_connect_cb,
client_disconnect_cb,
NULL  ,
GNUNET_MQ_hd_var_size(get, 4, struct GNUNET_W32RESOLVER_GetMessage, NULL)  ,
GNUNET_MQ_handler_end()   
)

Define "main" method using service macro.

Referenced by client_disconnect_cb().

Here is the caller graph for this function:

Variable Documentation

◆ rq_head

struct request* rq_head
static

Head of the doubly-linked list (for cleanup).

Definition at line 84 of file gnunet-gns-helper-service-w32.c.

◆ rq_tail

struct request* rq_tail
static

Tail of the doubly-linked list (for cleanup).

Definition at line 89 of file gnunet-gns-helper-service-w32.c.

◆ gns

struct GNUNET_GNS_Handle* gns
static

Handle to GNS service.

Definition at line 94 of file gnunet-gns-helper-service-w32.c.

◆ id_op

struct GNUNET_IDENTITY_Operation* id_op
static

Active operation on identity service.

Definition at line 99 of file gnunet-gns-helper-service-w32.c.

◆ identity

struct GNUNET_IDENTITY_Handle* identity
static

Handle for identity service.

Definition at line 104 of file gnunet-gns-helper-service-w32.c.

◆ gns_master_pubkey

struct GNUNET_CRYPTO_EcdsaPublicKey gns_master_pubkey
static

Public key of the gns-master ego.

Definition at line 109 of file gnunet-gns-helper-service-w32.c.

Referenced by get_ip_from_hostname(), and identity_master_cb().

◆ got_egos

int got_egos
static

Set to 1 once egos are obtained.

Definition at line 114 of file gnunet-gns-helper-service-w32.c.

Referenced by check_get(), and identity_master_cb().