GNUnet  0.11.x
Data Structures | Macros | Functions | Variables
gnunet-cmds-helper.c File Reference
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "testing_cmds.h"
#include "gnunet_testing_plugin.h"
#include <zlib.h>
Include dependency graph for gnunet-cmds-helper.c:

Go to the source code of this file.

Data Structures

struct  Plugin
 Handle for a plugin. More...
 
struct  NodeIdentifier
 Struct with information about a specific node and the whole network namespace setup. More...
 
struct  WriteContext
 Context for a single write on a chunk of memory. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log (kind, __VA_ARGS__)
 Generic logging shortcut testing_api_cmd_block_until_all_peers_started.c. More...
 
#define LOG_DEBUG(...)   LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
 Debug logging shorthand. More...
 
#define NODE_BASE_IP   "192.168.15."
 
#define KNOWN_BASE_IP   "92.68.151."
 
#define ROUTER_BASE_IP   "92.68.150."
 

Functions

static void shutdown_task (void *cls)
 Task to shut down cleanly. More...
 
static void write_task (void *cls)
 Task to write to the standard out. More...
 
static void write_message (struct GNUNET_MessageHeader *message, size_t msg_length)
 Callback to write a message to the master loop. More...
 
static int tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message)
 Functions with this signature are called whenever a complete message is received by the tokenizer. More...
 
static void read_task (void *cls)
 Task to read from stdin. More...
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Main function that will be run. More...
 
static void sighandler_child_death ()
 Signal handler called for SIGCHLD. More...
 
int main (int argc, char **argv)
 Main function. More...
 

Variables

struct Pluginplugin
 The process handle to the testbed service. More...
 
static struct GNUNET_TESTING_Systemtest_system
 Handle to the testing system. More...
 
struct GNUNET_MessageStreamTokenizertokenizer
 Our message stream tokenizer. More...
 
static struct GNUNET_DISK_FileHandlestdin_fd
 Disk handle from stdin. More...
 
static struct GNUNET_DISK_FileHandlestdout_fd
 Disk handle for stdout. More...
 
static struct GNUNET_DISK_PipeHandlesigpipe
 Pipe used to communicate shutdown via signal. More...
 
static struct GNUNET_SCHEDULER_Taskread_task_id
 Task identifier for the read task. More...
 
static struct GNUNET_SCHEDULER_Taskwrite_task_id
 Task identifier for the write task. More...
 
static int done_reading
 Are we done reading messages from stdin? More...
 
static int status
 Result to return in case we fail. More...
 

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log (kind, __VA_ARGS__)

Generic logging shortcut testing_api_cmd_block_until_all_peers_started.c.

Definition at line 51 of file gnunet-cmds-helper.c.

◆ LOG_DEBUG

#define LOG_DEBUG (   ...)    LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)

Debug logging shorthand.

Definition at line 56 of file gnunet-cmds-helper.c.

◆ NODE_BASE_IP

#define NODE_BASE_IP   "192.168.15."

Definition at line 58 of file gnunet-cmds-helper.c.

◆ KNOWN_BASE_IP

#define KNOWN_BASE_IP   "92.68.151."

Definition at line 60 of file gnunet-cmds-helper.c.

◆ ROUTER_BASE_IP

#define ROUTER_BASE_IP   "92.68.150."

Definition at line 62 of file gnunet-cmds-helper.c.

Function Documentation

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Task to shut down cleanly.

Parameters
clsNULL

Definition at line 230 of file gnunet-cmds-helper.c.

231 {
232 
233  LOG_DEBUG ("Shutting down.\n");
234 
235  if (NULL != read_task_id)
236  {
238  read_task_id = NULL;
239  }
240  if (NULL != write_task_id)
241  {
242  struct WriteContext *wc;
243 
245  write_task_id = NULL;
246  GNUNET_free (wc->data);
247  GNUNET_free (wc);
248  }
249  if (NULL != stdin_fd)
251  if (NULL != stdout_fd)
254  tokenizer = NULL;
255 
256  if (NULL != test_system)
257  {
259  test_system = NULL;
260  }
261 }
struct GNUNET_MessageStreamTokenizer * tokenizer
Our message stream tokenizer.
static struct GNUNET_DISK_FileHandle * stdout_fd
Disk handle for stdout.
#define LOG_DEBUG(...)
Debug logging shorthand.
static struct GNUNET_TESTING_System * test_system
Handle to the testing system.
static struct GNUNET_SCHEDULER_Task * read_task_id
Task identifier for the read task.
static struct GNUNET_SCHEDULER_Task * write_task_id
Task identifier for the write task.
static struct GNUNET_DISK_FileHandle * stdin_fd
Disk handle from stdin.
@ GNUNET_YES
Definition: gnunet_common.h:97
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1306
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972
void GNUNET_MST_destroy(struct GNUNET_MessageStreamTokenizer *mst)
Destroys a tokenizer.
Definition: mst.c:411
void GNUNET_TESTING_system_destroy(struct GNUNET_TESTING_System *system, int remove_paths)
Free system resources.
Definition: testing.c:529
Context for a single write on a chunk of memory.
void * data
The data to write.

References WriteContext::data, GNUNET_DISK_file_close(), GNUNET_free, GNUNET_MST_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_TESTING_system_destroy(), GNUNET_YES, LOG_DEBUG, read_task_id, stdin_fd, stdout_fd, test_system, tokenizer, and write_task_id.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_task()

static void write_task ( void *  cls)
static

Task to write to the standard out.

Parameters
clsthe WriteContext

Definition at line 270 of file gnunet-cmds-helper.c.

271 {
272  struct WriteContext *wc = cls;
273  ssize_t bytes_wrote;
274 
275  GNUNET_assert (NULL != wc);
276  write_task_id = NULL;
277  bytes_wrote = GNUNET_DISK_file_write (stdout_fd,
278  wc->data + wc->pos,
279  wc->length - wc->pos);
280  if (GNUNET_SYSERR == bytes_wrote)
281  {
283  "Cannot reply back successful initialization\n");
284  GNUNET_free (wc->data);
285  GNUNET_free (wc);
286  return;
287  }
288  wc->pos += bytes_wrote;
289  if (wc->pos == wc->length)
290  {
291  GNUNET_free (wc->data);
292  GNUNET_free (wc);
293  return;
294  }
296  stdout_fd,
297  &write_task,
298  wc);
299 }
static void write_task(void *cls)
Task to write to the standard out.
#define LOG(kind,...)
Generic logging shortcut testing_api_cmd_block_until_all_peers_started.c.
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
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
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_WARNING
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:1700
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
size_t pos
The current position from where the write operation should begin.
size_t length
The length of the data.

References WriteContext::data, GNUNET_assert, GNUNET_DISK_file_write(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_SCHEDULER_add_write_file(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, WriteContext::length, LOG, WriteContext::pos, stdout_fd, and write_task_id.

Referenced by write_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_message()

static void write_message ( struct GNUNET_MessageHeader message,
size_t  msg_length 
)
static

Callback to write a message to the master loop.

Definition at line 307 of file gnunet-cmds-helper.c.

308 {
309  struct WriteContext *wc;
310 
311  wc = GNUNET_new (struct WriteContext);
312  wc->length = msg_length;
313  wc->data = message;
316  stdout_fd,
317  &write_task,
318  wc);
319 }
#define GNUNET_new(type)
Allocate a struct or union of the given type.

References WriteContext::data, GNUNET_new, GNUNET_SCHEDULER_add_write_file(), GNUNET_TIME_UNIT_FOREVER_REL, WriteContext::length, stdout_fd, write_task(), and write_task_id.

Referenced by tokenizer_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tokenizer_cb()

static int tokenizer_cb ( void *  cls,
const struct GNUNET_MessageHeader message 
)
static

Functions with this signature are called whenever a complete message is received by the tokenizer.

Do not call #GNUNET_mst_destroy() in this callback

Parameters
clsidentification of the client
messagethe actual message
Returns
GNUNET_OK on success, GNUNET_NO to stop further processing (no error) GNUNET_SYSERR to stop further processing with error

Definition at line 335 of file gnunet-cmds-helper.c.

336 {
337 
338  struct NodeIdentifier *ni = cls;
339  const struct GNUNET_CMDS_HelperInit *msg;
340  struct GNUNET_CMDS_HelperReply *reply;
341  char *binary;
342  char *plugin_name;
343  size_t plugin_name_size;
344  uint16_t msize;
345  size_t msg_length;
346  char *router_ip;
347  char *node_ip;
348  unsigned int namespace_n;
349 
350  msize = ntohs (message->size);
351  if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT == ntohs (message->type))
352  {
353  msg = (const struct GNUNET_CMDS_HelperInit *) message;
354  plugin_name_size = ntohs (msg->plugin_name_size);
355  if ((sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_size) > msize)
356  {
357  GNUNET_break (0);
359  "Received unexpected message -- exiting\n");
360  goto error;
361  }
364  ((char *) &msg[1]),
365  plugin_name_size + 1);
366 
367  binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd");
368 
369  plugin = GNUNET_new (struct Plugin);
371  NULL);
373 
374  plugin->global_n = ni->global_n;
375  plugin->local_m = ni->local_m;
376  plugin->n = ni->n;
377  plugin->m = ni->m;
378 
379  router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->n)
380  + 1);
381  strcpy (router_ip, ROUTER_BASE_IP);
382  strcat (router_ip, plugin->n);
383 
384  sscanf (plugin->n, "%u", &namespace_n);
385 
386  if (0 == namespace_n)
387  {
389  "known node n: %s\n",
390  plugin->n);
391  node_ip = GNUNET_malloc (strlen (KNOWN_BASE_IP) + strlen (plugin->m) + 1);
392  strcat (node_ip, KNOWN_BASE_IP);
393  }
394  else
395  {
397  "subnet node n: %s\n",
398  plugin->n);
399  node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->m) + 1);
400  strcat (node_ip, NODE_BASE_IP);
401  }
402  strcat (node_ip, plugin->m);
403 
404  plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m,
405  plugin->n, plugin->local_m);
406 
407  GNUNET_free (binary);
408 
409  msg_length = sizeof(struct GNUNET_CMDS_HelperReply);
410  reply = GNUNET_new (struct GNUNET_CMDS_HelperReply);
412  reply->header.size = htons ((uint16_t) msg_length);
413 
414  write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
415 
416  return GNUNET_OK;
417  }
419  message->type))
420  {
421  plugin->api->all_peers_started ();
422  return GNUNET_OK;
423  }
424  else
425  {
426  LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- exiting\n");
427  goto error;
428  }
429 
430 
431  error:
434  "tokenizer shutting down!\n");
436  return GNUNET_SYSERR;
437 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static void write_message(struct GNUNET_MessageHeader *message, size_t msg_length)
Callback to write a message to the master loop.
static int status
Result to return in case we fail.
#define NODE_BASE_IP
struct Plugin * plugin
The process handle to the testbed service.
#define ROUTER_BASE_IP
#define KNOWN_BASE_IP
static char * plugin_name
Name of our plugin.
@ GNUNET_OK
Definition: gnunet_common.h:95
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_malloc(size)
Wrapper around malloc.
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 ...
void * GNUNET_PLUGIN_load(const char *library_name, void *arg)
Setup plugin (runs the "init" callback and returns whatever "init" returned).
Definition: plugin.c:217
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY
The reply message from gnunet-cmds-helper.
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT
The initialization message towards gnunet-cmds-helper.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
size_t GNUNET_strlcpy(char *dst, const char *src, size_t n)
Like strlcpy but portable.
Definition: strings.c:162
Initialization message for gnunet-cmds-testbed to start cmd binary.
Definition: testing_cmds.h:38
Reply message from cmds helper process.
Definition: testing_cmds.h:57
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY.
Definition: testing_cmds.h:61
Header for all communications.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
Struct with information about a specific node and the whole network namespace setup.
char * m
The number of the node in the namespace.
char * n
The number of the namespace this node is in.
char * local_m
The number of local nodes per namespace.
char * global_n
The number of namespaces.
Handle for a plugin.
Definition: block.c:38
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
char * m
The number of the node in the namespace.
char * n
The number of the namespace this node is in.
char * global_n
The number of namespaces.
char * local_m
The number of local nodes per namespace.
char * library_name
Name of the shared library.
Definition: block.c:42

References Plugin::api, Plugin::global_n, NodeIdentifier::global_n, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_malloc, GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED, GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT, GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY, GNUNET_new, GNUNET_OK, GNUNET_OS_get_libexec_binary_path(), GNUNET_PLUGIN_load(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_strlcpy(), GNUNET_SYSERR, GNUNET_CMDS_HelperReply::header, KNOWN_BASE_IP, Plugin::library_name, Plugin::local_m, NodeIdentifier::local_m, LOG, Plugin::m, NodeIdentifier::m, msg, Plugin::n, NodeIdentifier::n, NODE_BASE_IP, plugin, plugin_name, GNUNET_CMDS_HelperInit::plugin_name_size, ROUTER_BASE_IP, GNUNET_MessageHeader::size, status, GNUNET_MessageHeader::type, and write_message().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_task()

static void read_task ( void *  cls)
static

Task to read from stdin.

Parameters
clsNULL

Definition at line 446 of file gnunet-cmds-helper.c.

447 {
449  ssize_t sread;
450 
451  read_task_id = NULL;
452  sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof(buf));
453  if ((GNUNET_SYSERR == sread) || (0 == sread))
454  {
455  LOG_DEBUG ("STDIN closed\n");
457  return;
458  }
459  if (GNUNET_YES == done_reading)
460  {
461  /* didn't expect any more data! */
462  GNUNET_break_op (0);
464  "tokenizer shutting down during reading, didn't expect any more data!\n");
466  return;
467  }
468  LOG_DEBUG ("Read %u bytes\n", (unsigned int) sread);
469  /* FIXME: could introduce a GNUNET_MST_read2 to read
470  directly from 'stdin_fd' and save a memcpy() here */
471  if (GNUNET_OK !=
473  {
474  GNUNET_break (0);
476  "tokenizer shutting down during reading, writing to buffer failed!\n");
478  return;
479  }
480  read_task_id /* No timeout while reading */
482  stdin_fd,
483  &read_task,
484  NULL);
485 }
static void read_task(void *cls)
Task to read from stdin.
static int done_reading
Are we done reading messages from stdin?
static char buf[2048]
@ GNUNET_NO
Definition: gnunet_common.h:94
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
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
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
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:1667
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

References buf, done_reading, GNUNET_break, GNUNET_break_op, GNUNET_DISK_file_read(), GNUNET_ERROR_TYPE_ERROR, GNUNET_MAX_MESSAGE_SIZE, GNUNET_MST_from_buffer(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, LOG, LOG_DEBUG, read_task_id, stdin_fd, and tokenizer.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Main function that will be run.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cfgconfiguration

Definition at line 497 of file gnunet-cmds-helper.c.

501 {
502  struct NodeIdentifier *ni = cls;
503 
504  LOG_DEBUG ("Starting interpreter loop helper...\n");
505 
510  stdin_fd,
511  &read_task,
512  NULL);
514 }
static void shutdown_task(void *cls)
Task to shut down cleanly.
static int tokenizer_cb(void *cls, const struct GNUNET_MessageHeader *message)
Functions with this signature are called whenever a complete message is received by the tokenizer.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_get_handle_from_native(FILE *fd)
Get a handle from a native FD.
Definition: disk.c:1344
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,...
Definition: scheduler.c:1331
struct GNUNET_MessageStreamTokenizer * GNUNET_MST_create(GNUNET_MessageTokenizerCallback cb, void *cb_cls)
Create a message stream tokenizer.
Definition: mst.c:85

References GNUNET_DISK_get_handle_from_native(), GNUNET_MST_create(), GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_TIME_UNIT_FOREVER_REL, LOG_DEBUG, read_task(), read_task_id, shutdown_task(), stdin_fd, stdout_fd, tokenizer, and tokenizer_cb().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sighandler_child_death()

static void sighandler_child_death ( void  )
static

Signal handler called for SIGCHLD.

Definition at line 521 of file gnunet-cmds-helper.c.

522 {
523  static char c;
524  int old_errno; /* back-up errno */
525 
526  old_errno = errno;
527  GNUNET_break (
528  1 ==
531  &c,
532  sizeof(c)));
533  errno = old_errno;
534 }
static struct GNUNET_DISK_PipeHandle * sigpipe
Pipe used to communicate shutdown via signal.
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
@ GNUNET_DISK_PIPE_END_WRITE
The writing-end of a pipe.

References GNUNET_break, GNUNET_DISK_file_write(), GNUNET_DISK_PIPE_END_WRITE, GNUNET_DISK_pipe_handle(), and sigpipe.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Main function.

Parameters
argcthe number of command line arguments
argvcommand line arg array
Returns
return code

Definition at line 545 of file gnunet-cmds-helper.c.

546 {
547  struct NodeIdentifier *ni;
551  int ret;
552 
553  GNUNET_log_setup ("gnunet-cmds-helper",
554  "DEBUG",
555  NULL);
556  ni = GNUNET_new (struct NodeIdentifier);
557  ni->global_n = argv[1];
558  ni->local_m = argv[2];
559  ni->m = argv[3];
560  ni->n = argv[4];
561 
562  status = GNUNET_OK;
563  if (NULL ==
565  {
566  GNUNET_break (0);
567  return 1;
568  }
569  shc_chld =
571  ret = GNUNET_PROGRAM_run (argc,
572  argv,
573  "gnunet-cmds-helper",
574  "Helper for starting a local interpreter loop",
575  options,
576  &run,
577  ni);
578 
580  shc_chld = NULL;
582  GNUNET_free (ni);
583  if (GNUNET_OK != ret)
584  return 1;
585  return (GNUNET_OK == status) ? 0 : 1;
586 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
static struct GNUNET_SIGNAL_Context * shc_chld
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static void sighandler_child_death()
Signal handler called for SIGCHLD.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run.
enum GNUNET_GenericReturnValue GNUNET_DISK_pipe_close(struct GNUNET_DISK_PipeHandle *p)
Closes an interprocess channel.
Definition: disk.c:1585
struct GNUNET_DISK_PipeHandle * GNUNET_DISK_pipe(enum GNUNET_DISK_PipeFlags pf)
Creates an interprocess channel.
Definition: disk.c:1442
@ GNUNET_DISK_PF_NONE
No special options, use non-blocking read/write operations.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition: program.c:364
struct GNUNET_SIGNAL_Context * GNUNET_SIGNAL_handler_install(int signal, GNUNET_SIGNAL_Handler handler)
Install a signal handler that will be run if the given signal is received.
Definition: signal.c:51
void GNUNET_SIGNAL_handler_uninstall(struct GNUNET_SIGNAL_Context *ctx)
Uninstall a previously installed signal handler.
Definition: signal.c:77
#define GNUNET_SIGCHLD
Definition: platform.h:42
Definition of a command line option.

References NodeIdentifier::global_n, GNUNET_break, GNUNET_DISK_PF_NONE, GNUNET_DISK_pipe(), GNUNET_DISK_pipe_close(), GNUNET_free, GNUNET_GETOPT_OPTION_END, GNUNET_log_setup(), GNUNET_new, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_SIGCHLD, GNUNET_SIGNAL_handler_install(), GNUNET_SIGNAL_handler_uninstall(), NodeIdentifier::local_m, NodeIdentifier::m, NodeIdentifier::n, options, ret, run(), shc_chld, sighandler_child_death(), sigpipe, and status.

Here is the call graph for this function:

Variable Documentation

◆ plugin

struct Plugin* plugin

The process handle to the testbed service.

static struct GNUNET_OS_Process *cmd_binary_process; Plugin to dynamically load a test case.

Definition at line 176 of file gnunet-cmds-helper.c.

Referenced by __attribute__(), ack_message_sent(), ack_proc(), add_plugin(), address_notification(), analyze_send_error(), append_port(), broadcast_mst_cb(), check_port(), client_configure_plugin(), client_connect(), client_delete_session(), client_lookup_session(), client_receive_mst_cb(), client_run(), client_schedule(), client_send_cb(), client_start(), connect_notify(), core_connect_cb(), core_disconnect_cb(), core_init_cb(), create_macendpoint(), create_session(), create_source(), create_target(), database_setup(), database_shutdown(), delete_by_rowid(), delete_entries(), delete_old_block(), delete_value(), dequeue(), destroy_session_cb(), disconnect_and_free_it(), disconnect_notify(), do_delete_entry(), do_transmit(), enqueue(), enqueue_fragment(), execute_get(), execute_select(), expi_proc(), expire_blocks(), expire_entries(), find_plugin(), find_source(), find_target(), fragmented_message_done(), free_macendpoint(), free_value(), get_records_and_call_iterator(), get_session_delete_it(), get_wlan_header(), GNUNET_BLOCK_context_destroy(), GNUNET_BLOCK_evaluate(), GNUNET_BLOCK_get_key(), GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_typename_to_number(), GNUNET_GNSRECORD_value_to_string(), GNUNET_RECLAIM_attribute_number_to_typename(), GNUNET_RECLAIM_attribute_string_to_value(), GNUNET_RECLAIM_attribute_typename_to_number(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_RECLAIM_credential_get_attributes(), GNUNET_RECLAIM_credential_get_expiration(), GNUNET_RECLAIM_credential_get_issuer(), GNUNET_RECLAIM_credential_get_presentation(), GNUNET_RECLAIM_credential_number_to_typename(), GNUNET_RECLAIM_credential_string_to_value(), GNUNET_RECLAIM_credential_typename_to_number(), GNUNET_RECLAIM_credential_value_to_string(), GNUNET_RECLAIM_presentation_get_attributes(), GNUNET_RECLAIM_presentation_get_expiration(), GNUNET_RECLAIM_presentation_get_issuer(), GNUNET_RECLAIM_presentation_number_to_typename(), GNUNET_RECLAIM_presentation_string_to_value(), GNUNET_RECLAIM_presentation_typename_to_number(), GNUNET_RECLAIM_presentation_value_to_string(), handle_core_message(), handle_helper_message(), handle_tcp_data(), handle_tcp_nat_probe(), handle_tcp_welcome(), heap_get_keys(), heap_plugin_del(), heap_plugin_estimate_size(), heap_plugin_get(), heap_plugin_get_closest(), heap_plugin_get_expiration(), heap_plugin_get_key(), heap_plugin_get_random(), heap_plugin_get_replication(), heap_plugin_get_zero_anonymity(), heap_plugin_put(), heap_plugin_remove_key(), hello_offered_cb(), http_client_plugin_get_session(), http_client_plugin_peer_disconnect(), http_client_plugin_send(), http_client_plugin_session_disconnect(), http_client_plugin_setup_monitor(), http_common_plugin_address_to_string(), http_common_plugin_dnsresult_to_address(), http_common_plugin_string_to_address(), http_server_plugin_address_suggested(), http_server_plugin_disconnect_peer(), http_server_plugin_send(), http_server_plugin_setup_monitor(), iface_proc(), init_connection(), ip_drop(), ip_hold(), ip_send(), ip_try_connect(), iterate_entries(), kill_session(), libgnunet_plugin_datacache_heap_done(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datacache_postgres_done(), libgnunet_plugin_datacache_postgres_init(), libgnunet_plugin_datacache_sqlite_done(), libgnunet_plugin_datacache_sqlite_init(), libgnunet_plugin_datacache_template_done(), libgnunet_plugin_datacache_template_init(), libgnunet_plugin_datastore_heap_done(), libgnunet_plugin_datastore_heap_init(), libgnunet_plugin_datastore_mysql_done(), libgnunet_plugin_datastore_mysql_init(), libgnunet_plugin_datastore_postgres_done(), libgnunet_plugin_datastore_postgres_init(), libgnunet_plugin_datastore_sqlite_done(), libgnunet_plugin_datastore_sqlite_init(), libgnunet_plugin_datastore_template_done(), libgnunet_plugin_datastore_template_init(), libgnunet_plugin_dhtu_gnunet_done(), libgnunet_plugin_dhtu_ip_done(), libgnunet_plugin_dhtu_ip_init(), libgnunet_plugin_namecache_flat_done(), libgnunet_plugin_namecache_flat_init(), libgnunet_plugin_namecache_postgres_done(), libgnunet_plugin_namecache_postgres_init(), libgnunet_plugin_namecache_sqlite_done(), libgnunet_plugin_namecache_sqlite_init(), libgnunet_plugin_namestore_flat_done(), libgnunet_plugin_namestore_flat_init(), libgnunet_plugin_namestore_postgres_done(), libgnunet_plugin_namestore_postgres_init(), libgnunet_plugin_namestore_sqlite_done(), libgnunet_plugin_namestore_sqlite_init(), libgnunet_plugin_peerstore_flat_done(), libgnunet_plugin_peerstore_flat_init(), libgnunet_plugin_peerstore_sqlite_done(), libgnunet_plugin_peerstore_sqlite_init(), libgnunet_plugin_rest_config_done(), libgnunet_plugin_rest_config_init(), libgnunet_plugin_rest_copying_done(), libgnunet_plugin_rest_copying_init(), libgnunet_plugin_rest_gns_done(), libgnunet_plugin_rest_gns_init(), libgnunet_plugin_rest_identity_done(), libgnunet_plugin_rest_identity_init(), libgnunet_plugin_rest_namestore_done(), libgnunet_plugin_rest_namestore_init(), libgnunet_plugin_rest_openid_connect_done(), libgnunet_plugin_rest_openid_connect_init(), libgnunet_plugin_rest_pabc_init(), libgnunet_plugin_rest_peerinfo_done(), libgnunet_plugin_rest_peerinfo_init(), libgnunet_plugin_rest_reclaim_done(), libgnunet_plugin_rest_reclaim_init(), LIBGNUNET_PLUGIN_TRANSPORT_DONE(), libgnunet_plugin_transport_http_client_done(), libgnunet_plugin_transport_http_client_init(), libgnunet_plugin_transport_tcp_done(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_template_init(), libgnunet_plugin_transport_unix_done(), libgnunet_plugin_transport_unix_init(), load_plugin(), lookup_session(), mysql_plugin_drop(), mysql_plugin_estimate_size(), mysql_plugin_get_expiration(), mysql_plugin_get_key(), mysql_plugin_get_keys(), mysql_plugin_get_replication(), mysql_plugin_get_zero_anonymity(), mysql_plugin_put(), mysql_plugin_remove_key(), namecache_cache_block(), namecache_expire_blocks(), namecache_lookup_block(), namecache_postgres_cache_block(), namecache_postgres_expire_blocks(), namecache_postgres_lookup_block(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), namecache_sqlite_lookup_block(), namestore_flat_iterate_records(), namestore_flat_lookup_records(), namestore_flat_store_records(), namestore_flat_zone_to_name(), namestore_postgres_iterate_records(), namestore_postgres_lookup_records(), namestore_postgres_store_records(), namestore_postgres_zone_to_name(), namestore_sqlite_iterate_records(), namestore_sqlite_lookup_records(), namestore_sqlite_store_records(), namestore_sqlite_zone_to_name(), notify_send_probe(), notify_session_monitor(), nse_cb(), peerinfo_cb(), peerstore_flat_delete_records(), peerstore_flat_expire_records(), peerstore_flat_iterate_records(), peerstore_flat_store_record(), peerstore_sqlite_delete_records(), peerstore_sqlite_expire_records(), peerstore_sqlite_iterate_records(), peerstore_sqlite_store_record(), postgres_plugin_del(), postgres_plugin_drop(), postgres_plugin_estimate_size(), postgres_plugin_get(), postgres_plugin_get_closest(), postgres_plugin_get_expiration(), postgres_plugin_get_key(), postgres_plugin_get_keys(), postgres_plugin_get_random(), postgres_plugin_get_replication(), postgres_plugin_get_zero_anonymity(), postgres_plugin_put(), postgres_plugin_remove_key(), prepare_beacon(), process_data(), process_ifcs(), process_inbound_tokenized_messages(), process_result(), process_udp_message(), qc_fragment_sent(), qc_message_sent(), read_cb(), read_process_ack(), read_process_fragment(), remove_timeout_messages_and_select(), repl_proc(), run_mhd_start_daemon(), scan(), schedule_select_v4(), schedule_select_v6(), send_hello_beacon(), send_session_info_iter(), send_with_fragmentation(), server_accept_cb(), server_access_cb(), server_add_address(), server_configure_plugin(), server_connection_cb(), server_delete_session(), server_disconnect_cb(), server_get_addresses(), server_lookup_connection(), server_mhd_connection_timeout(), server_nat_port_map_callback(), server_notify_external_hostname(), server_parse_url(), server_receive_mst_cb(), server_remove_address(), server_reschedule(), server_schedule(), server_start(), server_start_report_addresses(), server_stop_report_addresses(), server_v4_run(), server_v6_run(), session_disconnect_it(), session_timeout(), setup_broadcast(), setup_sockets(), sqlite_plugin_del(), sqlite_plugin_drop(), sqlite_plugin_estimate_size(), sqlite_plugin_get(), sqlite_plugin_get_closest(), sqlite_plugin_get_expiration(), sqlite_plugin_get_key(), sqlite_plugin_get_keys(), sqlite_plugin_get_random(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), sqlite_plugin_put(), sqlite_plugin_remove_key(), start_helper(), tcp_nat_port_map_callback(), tcp_plugin_address_pretty_printer(), tcp_plugin_check_address(), tcp_plugin_disconnect(), tcp_plugin_disconnect_session(), tcp_plugin_get_network(), tcp_plugin_get_session(), tcp_plugin_send(), tcp_plugin_setup_monitor(), tcp_plugin_string_to_address(), template_plugin_setup_monitor(), tokenizer_cb(), udp_broadcast_receive(), udp_disconnect(), udp_disconnect_session(), udp_ipv4_broadcast_send(), udp_ipv6_broadcast_send(), udp_nat_port_map_callback(), udp_plugin_address_pretty_printer(), udp_plugin_check_address(), udp_plugin_create_session(), udp_plugin_get_session(), udp_plugin_lookup_session(), udp_plugin_select_v4(), udp_plugin_select_v6(), udp_plugin_send(), udp_plugin_setup_monitor(), udp_plugin_update_session_timeout(), udp_select_read(), udp_select_send(), udp_string_to_address(), unix_demultiplexer(), unix_plugin_check_address(), unix_plugin_do_read(), unix_plugin_do_write(), unix_plugin_get_network(), unix_plugin_get_session(), unix_plugin_peer_disconnect(), unix_plugin_select_read(), unix_plugin_select_write(), unix_plugin_send(), unix_plugin_session_disconnect(), unix_plugin_setup_monitor(), unix_plugin_string_to_address(), unix_plugin_update_session_timeout(), unix_transport_server_start(), wlan_data_message_handler(), wlan_plugin_address_suggested(), wlan_plugin_disconnect_peer(), wlan_plugin_disconnect_session(), wlan_plugin_get_session(), wlan_plugin_send(), wlan_plugin_setup_monitor(), and wlan_plugin_string_to_address().

◆ test_system

struct GNUNET_TESTING_System* test_system
static

Handle to the testing system.

Definition at line 181 of file gnunet-cmds-helper.c.

Referenced by shutdown_task().

◆ tokenizer

struct GNUNET_MessageStreamTokenizer* tokenizer

Our message stream tokenizer.

Definition at line 186 of file gnunet-cmds-helper.c.

Referenced by read_task(), run(), and shutdown_task().

◆ stdin_fd

struct GNUNET_DISK_FileHandle* stdin_fd
static

Disk handle from stdin.

Definition at line 191 of file gnunet-cmds-helper.c.

Referenced by read_task(), run(), and shutdown_task().

◆ stdout_fd

struct GNUNET_DISK_FileHandle* stdout_fd
static

Disk handle for stdout.

Definition at line 196 of file gnunet-cmds-helper.c.

Referenced by run(), shutdown_task(), write_message(), and write_task().

◆ sigpipe

struct GNUNET_DISK_PipeHandle* sigpipe
static

Pipe used to communicate shutdown via signal.

Definition at line 201 of file gnunet-cmds-helper.c.

Referenced by main(), and sighandler_child_death().

◆ read_task_id

struct GNUNET_SCHEDULER_Task* read_task_id
static

Task identifier for the read task.

Definition at line 206 of file gnunet-cmds-helper.c.

Referenced by read_task(), run(), and shutdown_task().

◆ write_task_id

struct GNUNET_SCHEDULER_Task* write_task_id
static

Task identifier for the write task.

Definition at line 211 of file gnunet-cmds-helper.c.

Referenced by shutdown_task(), write_message(), and write_task().

◆ done_reading

int done_reading
static

Are we done reading messages from stdin?

Definition at line 216 of file gnunet-cmds-helper.c.

Referenced by read_task().

◆ status

int status
static

Result to return in case we fail.

Definition at line 221 of file gnunet-cmds-helper.c.

Referenced by main(), and tokenizer_cb().