GNUnet  0.19.5
helper.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2011, 2012 Christian Grothoff
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
29 #include "platform.h"
30 #include "gnunet_util_lib.h"
31 
36 {
41 
46 
50  const struct GNUNET_MessageHeader *msg;
51 
56 
61 
65  void *cont_cls;
66 
70  unsigned int wpos;
71 };
72 
73 
78 {
83 
88 
93 
98 
103 
108 
113 
117  void *cb_cls;
118 
123 
128 
132  char *binary_name;
133 
137  char **binary_argv;
138 
143 
148 
153 
158 
162  unsigned int retry_back_off;
163 };
164 
165 
166 int
167 GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, int soft_kill)
168 {
170  int ret;
171 
172  while (NULL != (sh = h->sh_head))
173  {
174  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
175  if (NULL != sh->cont)
176  sh->cont (sh->cont_cls, GNUNET_NO);
177  GNUNET_free (sh);
178  }
179  if (NULL != h->restart_task)
180  {
181  GNUNET_SCHEDULER_cancel (h->restart_task);
182  h->restart_task = NULL;
183  }
184  if (NULL != h->read_task)
185  {
186  GNUNET_SCHEDULER_cancel (h->read_task);
187  h->read_task = NULL;
188  }
189  if (NULL == h->helper_proc)
190  return GNUNET_SYSERR;
191  if (GNUNET_YES == soft_kill)
192  {
193  /* soft-kill only possible with pipes */
194  GNUNET_assert (NULL != h->helper_in);
195  ret = GNUNET_DISK_pipe_close (h->helper_in);
196  h->helper_in = NULL;
197  h->fh_to_helper = NULL;
198  return ret;
199  }
200  if (0 != GNUNET_OS_process_kill (h->helper_proc, GNUNET_TERM_SIG))
201  return GNUNET_SYSERR;
202  return GNUNET_OK;
203 }
204 
205 
206 int
208 {
210  int ret;
211 
212  ret = GNUNET_SYSERR;
213  if (NULL != h->helper_proc)
214  {
215  ret = GNUNET_OS_process_wait (h->helper_proc);
216  GNUNET_OS_process_destroy (h->helper_proc);
217  h->helper_proc = NULL;
218  }
219  if (NULL != h->read_task)
220  {
221  GNUNET_SCHEDULER_cancel (h->read_task);
222  h->read_task = NULL;
223  }
224  if (NULL != h->write_task)
225  {
226  GNUNET_SCHEDULER_cancel (h->write_task);
227  h->write_task = NULL;
228  }
229  if (NULL != h->helper_in)
230  {
231  GNUNET_DISK_pipe_close (h->helper_in);
232  h->helper_in = NULL;
233  h->fh_to_helper = NULL;
234  }
235  if (NULL != h->helper_out)
236  {
237  GNUNET_DISK_pipe_close (h->helper_out);
238  h->helper_out = NULL;
239  h->fh_from_helper = NULL;
240  }
241  while (NULL != (sh = h->sh_head))
242  {
243  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
244  if (NULL != sh->cont)
245  sh->cont (sh->cont_cls, GNUNET_NO);
246  GNUNET_free (sh);
247  }
248  /* purge MST buffer */
249  if (NULL != h->mst)
250  (void) GNUNET_MST_from_buffer (h->mst, NULL, 0, GNUNET_YES, GNUNET_NO);
251  return ret;
252 }
253 
254 
262 static void
263 stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill)
264 {
265  if (NULL != h->restart_task)
266  {
267  GNUNET_SCHEDULER_cancel (h->restart_task);
268  h->restart_task = NULL;
269  }
270  else
271  {
272  GNUNET_break (GNUNET_OK == GNUNET_HELPER_kill (h, soft_kill));
274  }
275 }
276 
277 
283 static void
284 restart_task (void *cls);
285 
286 
292 static void
293 helper_read (void *cls)
294 {
295  struct GNUNET_HELPER_Handle *h = cls;
297  ssize_t t;
298 
299  h->read_task = NULL;
300  t = GNUNET_DISK_file_read (h->fh_from_helper, &buf, sizeof(buf));
301  if (t < 0)
302  {
303  /* On read-error, restart the helper */
305  _ ("Error reading from `%s': %s\n"),
306  h->binary_name,
307  strerror (errno));
308  if (NULL != h->exp_cb)
309  {
310  h->exp_cb (h->cb_cls);
312  return;
313  }
315  /* Restart the helper */
316  h->restart_task = GNUNET_SCHEDULER_add_delayed (
318  h->retry_back_off),
319  &restart_task,
320  h);
321  return;
322  }
323  if (0 == t)
324  {
325  /* this happens if the helper is shut down via a
326  signal, so it is not a "hard" error */
328  "Got 0 bytes from helper `%s' (EOF)\n",
329  h->binary_name);
330  if (NULL != h->exp_cb)
331  {
332  h->exp_cb (h->cb_cls);
334  return;
335  }
337  /* Restart the helper */
338  h->restart_task = GNUNET_SCHEDULER_add_delayed (
340  h->retry_back_off),
341  &restart_task,
342  h);
343  return;
344  }
346  "Got %u bytes from helper `%s'\n",
347  (unsigned int) t,
348  h->binary_name);
350  h->fh_from_helper,
351  &helper_read,
352  h);
353  if (GNUNET_SYSERR ==
355  {
357  _ ("Failed to parse inbound message from helper `%s'\n"),
358  h->binary_name);
359  if (NULL != h->exp_cb)
360  {
361  h->exp_cb (h->cb_cls);
363  return;
364  }
366  /* Restart the helper */
367  h->restart_task = GNUNET_SCHEDULER_add_delayed (
369  h->retry_back_off),
370  &restart_task,
371  h);
372  return;
373  }
374 }
375 
376 
382 static void
384 {
385  h->helper_in =
387  h->helper_out =
389  if ((h->helper_in == NULL) || (h->helper_out == NULL))
390  {
391  /* out of file descriptors? try again later... */
393  "out of file descriptors? try again later\n");
395  h->restart_task = GNUNET_SCHEDULER_add_delayed (
397  h->retry_back_off),
398  &restart_task,
399  h);
400  return;
401  }
403  "Starting HELPER process `%s'\n",
404  h->binary_name);
405  h->fh_from_helper =
407  h->fh_to_helper =
409  h->helper_proc = GNUNET_OS_start_process_vap (h->with_control_pipe
413  h->helper_in,
414  h->helper_out,
415  NULL,
416  h->binary_name,
417  h->binary_argv);
418  if (NULL == h->helper_proc)
419  {
420  /* failed to start process? try again later... */
422  "failed to start process? try again later\n");
424  h->restart_task = GNUNET_SCHEDULER_add_delayed (
426  h->retry_back_off),
427  &restart_task,
428  h);
429  return;
430  }
433  if (NULL != h->mst)
435  h->fh_from_helper,
436  &helper_read,
437  h);
438 }
439 
440 
446 static void
447 restart_task (void *cls)
448 {
449  struct GNUNET_HELPER_Handle *h = cls;
450 
451  h->restart_task = NULL;
452  h->retry_back_off++;
454  "Restarting helper with back-off %u\n",
455  h->retry_back_off);
456  start_helper (h);
457 }
458 
459 
460 struct GNUNET_HELPER_Handle *
462  const char *binary_name,
463  char *const binary_argv[],
466  void *cb_cls)
467 {
468  struct GNUNET_HELPER_Handle *h;
469  unsigned int c;
470 
471  h = GNUNET_new (struct GNUNET_HELPER_Handle);
472  h->with_control_pipe = with_control_pipe;
473  /* Lookup in libexec path only if we are starting gnunet helpers */
474  if (NULL != strstr (binary_name, "gnunet"))
476  else
477  h->binary_name = GNUNET_strdup (binary_name);
478  for (c = 0; NULL != binary_argv[c]; c++)
479  ;
480  h->binary_argv = GNUNET_malloc (sizeof(char *) * (c + 1));
481  for (c = 0; NULL != binary_argv[c]; c++)
482  h->binary_argv[c] = GNUNET_strdup (binary_argv[c]);
483  h->binary_argv[c] = NULL;
484  h->cb_cls = cb_cls;
485  if (NULL != cb)
486  h->mst = GNUNET_MST_create (cb, h->cb_cls);
487  h->exp_cb = exp_cb;
488  h->retry_back_off = 0;
489  start_helper (h);
490  return h;
491 }
492 
493 
499 void
501 {
502  unsigned int c;
504 
505  if (NULL != h->write_task)
506  {
507  GNUNET_SCHEDULER_cancel (h->write_task);
508  h->write_task = NULL;
509  }
510  GNUNET_assert (NULL == h->read_task);
511  GNUNET_assert (NULL == h->restart_task);
512  while (NULL != (sh = h->sh_head))
513  {
514  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
515  if (NULL != sh->cont)
516  sh->cont (sh->cont_cls, GNUNET_SYSERR);
517  GNUNET_free (sh);
518  }
519  if (NULL != h->mst)
520  GNUNET_MST_destroy (h->mst);
521  GNUNET_free (h->binary_name);
522  for (c = 0; h->binary_argv[c] != NULL; c++)
523  GNUNET_free (h->binary_argv[c]);
524  GNUNET_free (h->binary_argv);
525  GNUNET_free (h);
526 }
527 
528 
536 void
537 GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill)
538 {
539  h->exp_cb = NULL;
540  stop_helper (h, soft_kill);
542 }
543 
544 
550 static void
551 helper_write (void *cls)
552 {
553  struct GNUNET_HELPER_Handle *h = cls;
555  const char *buf;
556  ssize_t t;
557 
558  h->write_task = NULL;
559  if (NULL == (sh = h->sh_head))
560  {
561  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Helper write had no work!\n");
562  return; /* how did this happen? */
563  }
564  buf = (const char *) sh->msg;
565  t = GNUNET_DISK_file_write (h->fh_to_helper,
566  &buf[sh->wpos],
567  ntohs (sh->msg->size) - sh->wpos);
568  if (-1 == t)
569  {
570  /* On write-error, restart the helper */
572  _ ("Error writing to `%s': %s\n"),
573  h->binary_name,
574  strerror (errno));
575  if (NULL != h->exp_cb)
576  {
577  h->exp_cb (h->cb_cls);
579  return;
580  }
582  "Stopping and restarting helper task!\n");
584  /* Restart the helper */
585  h->restart_task = GNUNET_SCHEDULER_add_delayed (
587  h->retry_back_off),
588  &restart_task,
589  h);
590  return;
591  }
593  "Transmitted %u bytes to %s\n",
594  (unsigned int) t,
595  h->binary_name);
596  sh->wpos += t;
597  if (sh->wpos == ntohs (sh->msg->size))
598  {
599  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
600  if (NULL != sh->cont)
601  sh->cont (sh->cont_cls, GNUNET_YES);
602  GNUNET_free (sh);
603  }
604  if (NULL != h->sh_head)
605  h->write_task =
607  h->fh_to_helper,
608  &helper_write,
609  h);
610 }
611 
612 
615  const struct GNUNET_MessageHeader *msg,
616  int can_drop,
618  void *cont_cls)
619 {
621  uint16_t mlen;
622 
623  if (NULL == h->fh_to_helper)
624  return NULL;
625  if ((GNUNET_YES == can_drop) && (NULL != h->sh_head))
626  return NULL;
627  mlen = ntohs (msg->size);
628  sh = GNUNET_malloc (sizeof(struct GNUNET_HELPER_SendHandle) + mlen);
629  sh->msg = (const struct GNUNET_MessageHeader *) &sh[1];
630  GNUNET_memcpy (&sh[1], msg, mlen);
631  sh->h = h;
632  sh->cont = cont;
633  sh->cont_cls = cont_cls;
634  GNUNET_CONTAINER_DLL_insert_tail (h->sh_head, h->sh_tail, sh);
635  if (NULL == h->write_task)
636  h->write_task =
638  h->fh_to_helper,
639  &helper_write,
640  h);
641 
642  return sh;
643 }
644 
645 
653 void
655 {
656  struct GNUNET_HELPER_Handle *h = sh->h;
657 
658  sh->cont = NULL;
659  sh->cont_cls = NULL;
660  if (0 == sh->wpos)
661  {
662  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
663  GNUNET_free (sh);
664  if (NULL == h->sh_head)
665  {
666  GNUNET_SCHEDULER_cancel (h->write_task);
667  h->write_task = NULL;
668  }
669  }
670 }
671 
672 
673 /* end of helper.c */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static struct SolverHandle * sh
static char buf[2048]
static struct GNUNET_SCHEDULER_Task * t
Main task.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:686
enum GNUNET_GenericReturnValue GNUNET_DISK_pipe_close(struct GNUNET_DISK_PipeHandle *p)
Closes an interprocess channel.
Definition: disk.c:1587
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:622
const struct GNUNET_DISK_FileHandle * GNUNET_DISK_pipe_handle(const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n)
Get the handle to a particular pipe end.
Definition: disk.c:1617
enum GNUNET_GenericReturnValue GNUNET_DISK_pipe_close_end(struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd end)
Closes one half of an interprocess channel.
Definition: disk.c:1534
struct GNUNET_DISK_PipeHandle * GNUNET_DISK_pipe(enum GNUNET_DISK_PipeFlags pf)
Creates an interprocess channel.
Definition: disk.c:1444
@ GNUNET_DISK_PF_BLOCKING_RW
Configure both pipe ends for blocking operations if set.
@ GNUNET_DISK_PIPE_END_WRITE
The writing-end of a pipe.
@ GNUNET_DISK_PIPE_END_READ
The reading-end of a pipe.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
void GNUNET_HELPER_send_cancel(struct GNUNET_HELPER_SendHandle *sh)
Cancel a GNUNET_HELPER_send operation.
Definition: helper.c:654
int GNUNET_HELPER_kill(struct GNUNET_HELPER_Handle *h, int soft_kill)
Sends termination signal to the helper process.
Definition: helper.c:167
struct GNUNET_HELPER_SendHandle * GNUNET_HELPER_send(struct GNUNET_HELPER_Handle *h, const struct GNUNET_MessageHeader *msg, int can_drop, GNUNET_HELPER_Continuation cont, void *cont_cls)
Send an message to the helper.
Definition: helper.c:614
int GNUNET_HELPER_wait(struct GNUNET_HELPER_Handle *h)
Reap the helper process.
Definition: helper.c:207
void(* GNUNET_HELPER_Continuation)(void *cls, int result)
Continuation function.
struct GNUNET_HELPER_Handle * GNUNET_HELPER_start(int with_control_pipe, const char *binary_name, char *const binary_argv[], GNUNET_MessageTokenizerCallback cb, GNUNET_HELPER_ExceptionCallback exp_cb, void *cb_cls)
Starts a helper and begins reading from it.
Definition: helper.c:461
void(* GNUNET_HELPER_ExceptionCallback)(void *cls)
Callback that will be called when the helper process dies.
void GNUNET_HELPER_stop(struct GNUNET_HELPER_Handle *h, int soft_kill)
Kills the helper, closes the pipe and frees the handle.
Definition: helper.c:537
void GNUNET_HELPER_destroy(struct GNUNET_HELPER_Handle *h)
Free's the resources occupied by the helper handle.
Definition: helper.c:500
#define GNUNET_log(kind,...)
#define GNUNET_ALIGN
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
@ GNUNET_ERROR_TYPE_INFO
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
char * GNUNET_OS_get_libexec_binary_path(const char *progname)
Given the name of a gnunet-helper, gnunet-service or gnunet-daemon binary, try to prefix it with the ...
struct GNUNET_OS_Process * GNUNET_OS_start_process_vap(enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stderr, const char *filename, char *const argv[])
Start a process.
Definition: os_priority.c:567
void GNUNET_OS_process_destroy(struct GNUNET_OS_Process *proc)
Cleans up process structure contents (OS-dependent) and deallocates it.
Definition: os_priority.c:260
int GNUNET_OS_process_kill(struct GNUNET_OS_Process *proc, int sig)
Sends a signal to the process.
Definition: os_priority.c:210
enum GNUNET_GenericReturnValue GNUNET_OS_process_wait(struct GNUNET_OS_Process *proc)
Wait for a process to terminate.
Definition: os_priority.c:871
@ GNUNET_OS_INHERIT_STD_ERR
When this flag is set, the child process will inherit stderr of the parent.
Definition: gnunet_os_lib.h:95
@ GNUNET_OS_USE_PIPE_CONTROL
Should a pipe be used to send signals to the child?
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_file(struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
Definition: scheduler.c:1656
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_write_file(struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *wfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
Definition: scheduler.c:1689
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1272
int(* GNUNET_MessageTokenizerCallback)(void *cls, const struct GNUNET_MessageHeader *message)
Functions with this signature are called whenever a complete message is received by the tokenizer.
enum GNUNET_GenericReturnValue GNUNET_MST_from_buffer(struct GNUNET_MessageStreamTokenizer *mst, const char *buf, size_t size, int purge, int one_shot)
Add incoming data to the receive buffer and call the callback for all complete messages.
Definition: mst.c:101
void GNUNET_MST_destroy(struct GNUNET_MessageStreamTokenizer *mst)
Destroys a tokenizer.
Definition: mst.c:404
struct GNUNET_MessageStreamTokenizer * GNUNET_MST_create(GNUNET_MessageTokenizerCallback cb, void *cb_cls)
Create a message stream tokenizer.
Definition: mst.c:86
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:484
static void helper_write(void *cls)
Write to the helper-process.
Definition: helper.c:551
static void start_helper(struct GNUNET_HELPER_Handle *h)
Start the helper process.
Definition: helper.c:383
static void restart_task(void *cls)
Restart the helper process.
Definition: helper.c:447
static void helper_read(void *cls)
Read from the helper-process.
Definition: helper.c:293
static void stop_helper(struct GNUNET_HELPER_Handle *h, int soft_kill)
Stop the helper process, we're closing down or had an error.
Definition: helper.c:263
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
#define GNUNET_TERM_SIG
The termination signal.
Definition: platform.h:234
Handle used to access files (and pipes).
Handle used to manage a pipe.
Definition: disk.c:68
The handle to a helper process.
Definition: helper.c:78
GNUNET_HELPER_ExceptionCallback exp_cb
The exception callback.
Definition: helper.c:112
unsigned int retry_back_off
Count start attempts to increase linear back off.
Definition: helper.c:162
struct GNUNET_HELPER_SendHandle * sh_head
First message queued for transmission to helper.
Definition: helper.c:122
struct GNUNET_OS_Process * helper_proc
The process id of the helper.
Definition: helper.c:102
int with_control_pipe
Does the helper support the use of a control pipe for signalling?
Definition: helper.c:157
void * cb_cls
The closure for callbacks.
Definition: helper.c:117
struct GNUNET_HELPER_SendHandle * sh_tail
Last message queued for transmission to helper.
Definition: helper.c:127
struct GNUNET_DISK_PipeHandle * helper_in
PipeHandle to receive data from the helper.
Definition: helper.c:82
const struct GNUNET_DISK_FileHandle * fh_from_helper
FileHandle to receive data from the helper.
Definition: helper.c:92
const struct GNUNET_DISK_FileHandle * fh_to_helper
FileHandle to send data to the helper.
Definition: helper.c:97
struct GNUNET_SCHEDULER_Task * write_task
Task to read from the helper.
Definition: helper.c:147
struct GNUNET_DISK_PipeHandle * helper_out
PipeHandle to send data to the helper.
Definition: helper.c:87
struct GNUNET_SCHEDULER_Task * restart_task
Restart task.
Definition: helper.c:152
char ** binary_argv
NULL-terminated list of command-line arguments.
Definition: helper.c:137
struct GNUNET_MessageStreamTokenizer * mst
The Message-Tokenizer that tokenizes the messages coming from the helper.
Definition: helper.c:107
struct GNUNET_SCHEDULER_Task * read_task
Task to read from the helper.
Definition: helper.c:142
char * binary_name
Binary to run.
Definition: helper.c:132
Entry in the queue of messages we need to transmit to the helper.
Definition: helper.c:36
struct GNUNET_HELPER_SendHandle * prev
This is an entry in a DLL.
Definition: helper.c:45
struct GNUNET_HELPER_SendHandle * next
This is an entry in a DLL.
Definition: helper.c:40
struct GNUNET_HELPER_Handle * h
The handle to a helper process.
Definition: helper.c:55
GNUNET_HELPER_Continuation cont
Function to call upon completion.
Definition: helper.c:60
const struct GNUNET_MessageHeader * msg
Message to transmit (allocated at the end of this struct)
Definition: helper.c:50
void * cont_cls
Closure to 'cont'.
Definition: helper.c:65
unsigned int wpos
Current write position.
Definition: helper.c:70
Header for all communications.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
Handle to a message stream tokenizer.
Definition: mst.c:45
Entry in list of pending tasks.
Definition: scheduler.c:136
static void exp_cb(void *cls)
Callback called if there was an exception during execution of the helper.