GNUnet  0.16.x
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 
28 #include "platform.h"
29 #include "gnunet_util_lib.h"
30 #include "gnunet_mst_lib.h"
31 
32 
37 {
42 
47 
51  const struct GNUNET_MessageHeader *msg;
52 
57 
62 
66  void *cont_cls;
67 
71  unsigned int wpos;
72 };
73 
74 
79 {
84 
89 
94 
99 
104 
109 
114 
118  void *cb_cls;
119 
124 
129 
133  char *binary_name;
134 
138  char **binary_argv;
139 
144 
149 
154 
159 
163  unsigned int retry_back_off;
164 };
165 
166 
176 int
177 GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, int soft_kill)
178 {
180  int ret;
181 
182  while (NULL != (sh = h->sh_head))
183  {
184  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
185  if (NULL != sh->cont)
186  sh->cont (sh->cont_cls, GNUNET_NO);
187  GNUNET_free (sh);
188  }
189  if (NULL != h->restart_task)
190  {
191  GNUNET_SCHEDULER_cancel (h->restart_task);
192  h->restart_task = NULL;
193  }
194  if (NULL != h->read_task)
195  {
196  GNUNET_SCHEDULER_cancel (h->read_task);
197  h->read_task = NULL;
198  }
199  if (NULL == h->helper_proc)
200  return GNUNET_SYSERR;
201  if (GNUNET_YES == soft_kill)
202  {
203  /* soft-kill only possible with pipes */
204  GNUNET_assert (NULL != h->helper_in);
205  ret = GNUNET_DISK_pipe_close (h->helper_in);
206  h->helper_in = NULL;
207  h->fh_to_helper = NULL;
208  return ret;
209  }
210  if (0 != GNUNET_OS_process_kill (h->helper_proc, GNUNET_TERM_SIG))
211  return GNUNET_SYSERR;
212  return GNUNET_OK;
213 }
214 
215 
224 int
226 {
228  int ret;
229 
230  ret = GNUNET_SYSERR;
231  if (NULL != h->helper_proc)
232  {
233  ret = GNUNET_OS_process_wait (h->helper_proc);
234  GNUNET_OS_process_destroy (h->helper_proc);
235  h->helper_proc = NULL;
236  }
237  if (NULL != h->read_task)
238  {
239  GNUNET_SCHEDULER_cancel (h->read_task);
240  h->read_task = NULL;
241  }
242  if (NULL != h->write_task)
243  {
244  GNUNET_SCHEDULER_cancel (h->write_task);
245  h->write_task = NULL;
246  }
247  if (NULL != h->helper_in)
248  {
249  GNUNET_DISK_pipe_close (h->helper_in);
250  h->helper_in = NULL;
251  h->fh_to_helper = NULL;
252  }
253  if (NULL != h->helper_out)
254  {
255  GNUNET_DISK_pipe_close (h->helper_out);
256  h->helper_out = NULL;
257  h->fh_from_helper = NULL;
258  }
259  while (NULL != (sh = h->sh_head))
260  {
261  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
262  if (NULL != sh->cont)
263  sh->cont (sh->cont_cls, GNUNET_NO);
264  GNUNET_free (sh);
265  }
266  /* purge MST buffer */
267  if (NULL != h->mst)
268  (void) GNUNET_MST_from_buffer (h->mst, NULL, 0, GNUNET_YES, GNUNET_NO);
269  return ret;
270 }
271 
272 
280 static void
281 stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill)
282 {
283  if (NULL != h->restart_task)
284  {
285  GNUNET_SCHEDULER_cancel (h->restart_task);
286  h->restart_task = NULL;
287  }
288  else
289  {
290  GNUNET_break (GNUNET_OK == GNUNET_HELPER_kill (h, soft_kill));
292  }
293 }
294 
295 
301 static void
302 restart_task (void *cls);
303 
304 
310 static void
311 helper_read (void *cls)
312 {
313  struct GNUNET_HELPER_Handle *h = cls;
315  ssize_t t;
316 
317  h->read_task = NULL;
318  t = GNUNET_DISK_file_read (h->fh_from_helper, &buf, sizeof(buf));
319  if (t < 0)
320  {
321  /* On read-error, restart the helper */
323  _ ("Error reading from `%s': %s\n"),
324  h->binary_name,
325  strerror (errno));
326  if (NULL != h->exp_cb)
327  {
328  h->exp_cb (h->cb_cls);
330  return;
331  }
333  /* Restart the helper */
334  h->restart_task = GNUNET_SCHEDULER_add_delayed (
336  h->retry_back_off),
337  &restart_task,
338  h);
339  return;
340  }
341  if (0 == t)
342  {
343  /* this happens if the helper is shut down via a
344  signal, so it is not a "hard" error */
346  "Got 0 bytes from helper `%s' (EOF)\n",
347  h->binary_name);
348  if (NULL != h->exp_cb)
349  {
350  h->exp_cb (h->cb_cls);
352  return;
353  }
355  /* Restart the helper */
356  h->restart_task = GNUNET_SCHEDULER_add_delayed (
358  h->retry_back_off),
359  &restart_task,
360  h);
361  return;
362  }
364  "Got %u bytes from helper `%s'\n",
365  (unsigned int) t,
366  h->binary_name);
368  h->fh_from_helper,
369  &helper_read,
370  h);
371  if (GNUNET_SYSERR ==
373  {
375  _ ("Failed to parse inbound message from helper `%s'\n"),
376  h->binary_name);
377  if (NULL != h->exp_cb)
378  {
379  h->exp_cb (h->cb_cls);
381  return;
382  }
384  /* Restart the helper */
385  h->restart_task = GNUNET_SCHEDULER_add_delayed (
387  h->retry_back_off),
388  &restart_task,
389  h);
390  return;
391  }
392 }
393 
394 
400 static void
402 {
403  h->helper_in =
405  h->helper_out =
407  if ((h->helper_in == NULL) || (h->helper_out == NULL))
408  {
409  /* out of file descriptors? try again later... */
411  "out of file descriptors? try again later\n");
413  h->restart_task = GNUNET_SCHEDULER_add_delayed (
415  h->retry_back_off),
416  &restart_task,
417  h);
418  return;
419  }
421  "Starting HELPER process `%s'\n",
422  h->binary_name);
423  h->fh_from_helper =
425  h->fh_to_helper =
427  h->helper_proc = GNUNET_OS_start_process_vap (h->with_control_pipe
431  h->helper_in,
432  h->helper_out,
433  NULL,
434  h->binary_name,
435  h->binary_argv);
436  if (NULL == h->helper_proc)
437  {
438  /* failed to start process? try again later... */
440  "failed to start process? try again later\n");
442  h->restart_task = GNUNET_SCHEDULER_add_delayed (
444  h->retry_back_off),
445  &restart_task,
446  h);
447  return;
448  }
451  if (NULL != h->mst)
453  h->fh_from_helper,
454  &helper_read,
455  h);
456 }
457 
458 
464 static void
465 restart_task (void *cls)
466 {
467  struct GNUNET_HELPER_Handle *h = cls;
468 
469  h->restart_task = NULL;
470  h->retry_back_off++;
472  "Restarting helper with back-off %u\n",
473  h->retry_back_off);
474  start_helper (h);
475 }
476 
477 
494 struct GNUNET_HELPER_Handle *
496  const char *binary_name,
497  char *const binary_argv[],
500  void *cb_cls)
501 {
502  struct GNUNET_HELPER_Handle *h;
503  unsigned int c;
504 
505  h = GNUNET_new (struct GNUNET_HELPER_Handle);
506  h->with_control_pipe = with_control_pipe;
507  /* Lookup in libexec path only if we are starting gnunet helpers */
508  if (NULL != strstr (binary_name, "gnunet"))
510  else
511  h->binary_name = GNUNET_strdup (binary_name);
512  for (c = 0; NULL != binary_argv[c]; c++)
513  ;
514  h->binary_argv = GNUNET_malloc (sizeof(char *) * (c + 1));
515  for (c = 0; NULL != binary_argv[c]; c++)
516  h->binary_argv[c] = GNUNET_strdup (binary_argv[c]);
517  h->binary_argv[c] = NULL;
518  h->cb_cls = cb_cls;
519  if (NULL != cb)
520  h->mst = GNUNET_MST_create (cb, h->cb_cls);
521  h->exp_cb = exp_cb;
522  h->retry_back_off = 0;
523  start_helper (h);
524  return h;
525 }
526 
527 
533 void
535 {
536  unsigned int c;
538 
539  if (NULL != h->write_task)
540  {
541  GNUNET_SCHEDULER_cancel (h->write_task);
542  h->write_task = NULL;
543  }
544  GNUNET_assert (NULL == h->read_task);
545  GNUNET_assert (NULL == h->restart_task);
546  while (NULL != (sh = h->sh_head))
547  {
548  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
549  if (NULL != sh->cont)
550  sh->cont (sh->cont_cls, GNUNET_SYSERR);
551  GNUNET_free (sh);
552  }
553  if (NULL != h->mst)
554  GNUNET_MST_destroy (h->mst);
555  GNUNET_free (h->binary_name);
556  for (c = 0; h->binary_argv[c] != NULL; c++)
557  GNUNET_free (h->binary_argv[c]);
558  GNUNET_free (h->binary_argv);
559  GNUNET_free (h);
560 }
561 
562 
570 void
571 GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill)
572 {
573  h->exp_cb = NULL;
574  stop_helper (h, soft_kill);
576 }
577 
578 
584 static void
585 helper_write (void *cls)
586 {
587  struct GNUNET_HELPER_Handle *h = cls;
589  const char *buf;
590  ssize_t t;
591 
592  h->write_task = NULL;
593  if (NULL == (sh = h->sh_head))
594  {
595  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Helper write had no work!\n");
596  return; /* how did this happen? */
597  }
598  buf = (const char *) sh->msg;
599  t = GNUNET_DISK_file_write (h->fh_to_helper,
600  &buf[sh->wpos],
601  ntohs (sh->msg->size) - sh->wpos);
602  if (-1 == t)
603  {
604  /* On write-error, restart the helper */
606  _ ("Error writing to `%s': %s\n"),
607  h->binary_name,
608  strerror (errno));
609  if (NULL != h->exp_cb)
610  {
611  h->exp_cb (h->cb_cls);
613  return;
614  }
616  "Stopping and restarting helper task!\n");
618  /* Restart the helper */
619  h->restart_task = GNUNET_SCHEDULER_add_delayed (
621  h->retry_back_off),
622  &restart_task,
623  h);
624  return;
625  }
627  "Transmitted %u bytes to %s\n",
628  (unsigned int) t,
629  h->binary_name);
630  sh->wpos += t;
631  if (sh->wpos == ntohs (sh->msg->size))
632  {
633  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
634  if (NULL != sh->cont)
635  sh->cont (sh->cont_cls, GNUNET_YES);
636  GNUNET_free (sh);
637  }
638  if (NULL != h->sh_head)
639  h->write_task =
641  h->fh_to_helper,
642  &helper_write,
643  h);
644 }
645 
646 
662  const struct GNUNET_MessageHeader *msg,
663  int can_drop,
665  void *cont_cls)
666 {
668  uint16_t mlen;
669 
670  if (NULL == h->fh_to_helper)
671  return NULL;
672  if ((GNUNET_YES == can_drop) && (NULL != h->sh_head))
673  return NULL;
674  mlen = ntohs (msg->size);
675  sh = GNUNET_malloc (sizeof(struct GNUNET_HELPER_SendHandle) + mlen);
676  sh->msg = (const struct GNUNET_MessageHeader *) &sh[1];
677  GNUNET_memcpy (&sh[1], msg, mlen);
678  sh->h = h;
679  sh->cont = cont;
680  sh->cont_cls = cont_cls;
681  GNUNET_CONTAINER_DLL_insert_tail (h->sh_head, h->sh_tail, sh);
682  if (NULL == h->write_task)
683  h->write_task =
685  h->fh_to_helper,
686  &helper_write,
687  h);
688 
689  return sh;
690 }
691 
692 
700 void
702 {
703  struct GNUNET_HELPER_Handle *h = sh->h;
704 
705  sh->cont = NULL;
706  sh->cont_cls = NULL;
707  if (0 == sh->wpos)
708  {
709  GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
710  GNUNET_free (sh);
711  if (NULL == h->sh_head)
712  {
713  GNUNET_SCHEDULER_cancel (h->write_task);
714  h->write_task = NULL;
715  }
716  }
717 }
718 
719 
720 /* 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_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
Definition: gnunet_common.h:95
@ GNUNET_YES
Definition: gnunet_common.h:97
@ GNUNET_NO
Definition: gnunet_common.h:94
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
#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:1585
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:1616
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:1532
struct GNUNET_DISK_PipeHandle * GNUNET_DISK_pipe(enum GNUNET_DISK_PipeFlags pf)
Creates an interprocess channel.
Definition: disk.c:1442
@ 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:701
int GNUNET_HELPER_kill(struct GNUNET_HELPER_Handle *h, int soft_kill)
Sends termination signal to the helper process.
Definition: helper.c:177
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:661
int GNUNET_HELPER_wait(struct GNUNET_HELPER_Handle *h)
Reap the helper process.
Definition: helper.c:225
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:495
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:571
void GNUNET_HELPER_destroy(struct GNUNET_HELPER_Handle *h)
Free's the resources occupied by the helper handle.
Definition: helper.c:534
#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:604
int GNUNET_OS_process_wait(struct GNUNET_OS_Process *proc)
Wait for a process to terminate.
Definition: os_priority.c:983
void GNUNET_OS_process_destroy(struct GNUNET_OS_Process *proc)
Cleans up process structure contents (OS-dependent) and deallocates it.
Definition: os_priority.c:286
int GNUNET_OS_process_kill(struct GNUNET_OS_Process *proc, int sig)
Sends a signal to the process.
Definition: os_priority.c:224
@ GNUNET_OS_INHERIT_STD_ERR
When this flag is set, the child process will inherit stderr of the parent.
Definition: gnunet_os_lib.h:91
@ 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:1652
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:1685
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:957
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:1254
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.
void GNUNET_MST_destroy(struct GNUNET_MessageStreamTokenizer *mst)
Destroys a tokenizer.
Definition: mst.c:418
struct GNUNET_MessageStreamTokenizer * GNUNET_MST_create(GNUNET_MessageTokenizerCallback cb, void *cb_cls)
Create a message stream tokenizer.
Definition: mst.c:85
int 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:114
#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:483
static void helper_write(void *cls)
Write to the helper-process.
Definition: helper.c:585
static void start_helper(struct GNUNET_HELPER_Handle *h)
Start the helper process.
Definition: helper.c:401
static void restart_task(void *cls)
Restart the helper process.
Definition: helper.c:465
static void helper_read(void *cls)
Read from the helper-process.
Definition: helper.c:311
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:281
#define _(String)
GNU gettext support macro.
Definition: platform.h:177
#define GNUNET_TERM_SIG
The termination signal.
Definition: platform.h:233
Handle used to access files (and pipes).
Handle used to manage a pipe.
Definition: disk.c:69
The handle to a helper process.
Definition: helper.c:79
GNUNET_HELPER_ExceptionCallback exp_cb
The exception callback.
Definition: helper.c:113
unsigned int retry_back_off
Count start attempts to increase linear back off.
Definition: helper.c:163
struct GNUNET_HELPER_SendHandle * sh_head
First message queued for transmission to helper.
Definition: helper.c:123
struct GNUNET_OS_Process * helper_proc
The process id of the helper.
Definition: helper.c:103
int with_control_pipe
Does the helper support the use of a control pipe for signalling?
Definition: helper.c:158
void * cb_cls
The closure for callbacks.
Definition: helper.c:118
struct GNUNET_HELPER_SendHandle * sh_tail
Last message queued for transmission to helper.
Definition: helper.c:128
struct GNUNET_DISK_PipeHandle * helper_in
PipeHandle to receive data from the helper.
Definition: helper.c:83
const struct GNUNET_DISK_FileHandle * fh_from_helper
FileHandle to receive data from the helper.
Definition: helper.c:93
const struct GNUNET_DISK_FileHandle * fh_to_helper
FileHandle to send data to the helper.
Definition: helper.c:98
struct GNUNET_SCHEDULER_Task * write_task
Task to read from the helper.
Definition: helper.c:148
struct GNUNET_DISK_PipeHandle * helper_out
PipeHandle to send data to the helper.
Definition: helper.c:88
struct GNUNET_SCHEDULER_Task * restart_task
Restart task.
Definition: helper.c:153
char ** binary_argv
NULL-terminated list of command-line arguments.
Definition: helper.c:138
struct GNUNET_MessageStreamTokenizer * mst
The Message-Tokenizer that tokenizes the messages coming from the helper.
Definition: helper.c:108
struct GNUNET_SCHEDULER_Task * read_task
Task to read from the helper.
Definition: helper.c:143
char * binary_name
Binary to run.
Definition: helper.c:133
Entry in the queue of messages we need to transmit to the helper.
Definition: helper.c:37
struct GNUNET_HELPER_SendHandle * prev
This is an entry in a DLL.
Definition: helper.c:46
struct GNUNET_HELPER_SendHandle * next
This is an entry in a DLL.
Definition: helper.c:41
struct GNUNET_HELPER_Handle * h
The handle to a helper process.
Definition: helper.c:56
GNUNET_HELPER_Continuation cont
Function to call upon completion.
Definition: helper.c:61
const struct GNUNET_MessageHeader * msg
Message to transmit (allocated at the end of this struct)
Definition: helper.c:51
void * cont_cls
Closure to 'cont'.
Definition: helper.c:66
unsigned int wpos
Current write position.
Definition: helper.c:71
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:44
Entry in list of pending tasks.
Definition: scheduler.c:135
static void exp_cb(void *cls)
Callback called if there was an exception during execution of the helper.