GNUnet  0.11.x
Functions | Variables
gnunet-peerstore.c File Reference

peerstore tool More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_peerstore_service.h"
Include dependency graph for gnunet-peerstore.c:

Go to the source code of this file.


static void shutdown_task (void *cls)
 Run on shutdown. More...
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Main function that will be run by the scheduler. More...
int main (int argc, char *const *argv)
 The main function to peerstore. More...


static int ret
static struct GNUNET_PEERSTORE_Handlepeerstore_handle

Detailed Description

peerstore tool

Omar Tarabai

Definition in file gnunet-peerstore.c.

Function Documentation

◆ shutdown_task()

static void shutdown_task ( void *  cls)

Run on shutdown.


Definition at line 44 of file gnunet-peerstore.c.

References GNUNET_PEERSTORE_disconnect(), and GNUNET_YES.

Referenced by run().

45 {
46  if (NULL != peerstore_handle)
47  {
49  peerstore_handle = NULL;
50  }
51 }
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h, int sync_first)
Disconnect from the PEERSTORE service.
static struct GNUNET_PEERSTORE_Handle * peerstore_handle
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 

Main function that will be run by the scheduler.

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

Definition at line 63 of file gnunet-peerstore.c.

References GNUNET_assert, GNUNET_PEERSTORE_connect(), GNUNET_SCHEDULER_add_shutdown(), ret, and shutdown_task().

Referenced by main().

67 {
69  NULL);
72  ret = 0;
73 }
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:1331
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_PEERSTORE_Handle * peerstore_handle
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
static int ret
static void shutdown_task(void *cls)
Run on shutdown.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 

The main function to peerstore.

argcnumber of arguments from the command line
argvcommand line arguments
0 ok, 1 on error

Definition at line 84 of file gnunet-peerstore.c.

References gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_PROGRAM_run(), ret, and run().

85 {
86  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
88  };
90  return (GNUNET_OK ==
91  GNUNET_PROGRAM_run (argc, argv, "gnunet-peerstore [options [value]]",
92  gettext_noop ("peerstore"), options, &run,
93  NULL)) ? ret : 1;
94 }
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, parse options).
Definition: program.c:363
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
Definition of a command line option.
Definition: 002.c:13
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
static int ret
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ ret

int ret

Definition at line 30 of file gnunet-peerstore.c.

Referenced by main(), and run().

◆ peerstore_handle

struct GNUNET_PEERSTORE_Handle* peerstore_handle

Definition at line 35 of file gnunet-peerstore.c.