multicast: removed replay cancellation as responses are limited
[oweals/gnunet.git] / src / include / gnunet_program_lib.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2001-2013 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      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      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @file include/gnunet_program_lib.h
23  * @brief functions related to starting programs
24  * @author Christian Grothoff
25  * @defgroup program functions for writing command-line programs
26  * @{
27  */
28
29 #ifndef GNUNET_PROGRAM_LIB_H
30 #define GNUNET_PROGRAM_LIB_H
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #if 0                           /* keep Emacsens' auto-indent happy */
36 }
37 #endif
38 #endif
39
40 #include "gnunet_configuration_lib.h"
41 #include "gnunet_getopt_lib.h"
42 #include "gnunet_scheduler_lib.h"
43
44 /**
45  * Main function that will be run.
46  *
47  * @param cls closure
48  * @param args remaining command-line arguments
49  * @param cfgfile name of the configuration file used (for saving, can be NULL!)
50  * @param cfg configuration
51  */
52 typedef void
53 (*GNUNET_PROGRAM_Main) (void *cls,
54                         char *const *args,
55                         const char *cfgfile,
56                         const struct GNUNET_CONFIGURATION_Handle *cfg);
57
58
59 /**
60  * Run a standard GNUnet command startup sequence (initialize loggers
61  * and configuration, parse options).
62  *
63  * @param argc number of command line arguments in @a argv
64  * @param argv command line arguments
65  * @param binaryName our expected name
66  * @param binaryHelp help text for the program
67  * @param options command line options
68  * @param task main function to run
69  * @param task_cls closure for @a task
70  * @param run_without_scheduler #GNUNET_NO start the scheduler,
71  *        #GNUNET_YES do not start the scheduler just run the main task
72  * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
73  */
74 int
75 GNUNET_PROGRAM_run2 (int argc,
76                      char *const *argv,
77                      const char *binaryName,
78                      const char *binaryHelp,
79                      const struct GNUNET_GETOPT_CommandLineOption *options,
80                      GNUNET_PROGRAM_Main task,
81                      void *task_cls,
82                      int run_without_scheduler);
83
84 /**
85  * Run a standard GNUnet command startup sequence (initialize loggers
86  * and configuration, parse options).
87  *
88  * @param argc number of command line arguments
89  * @param argv command line arguments
90  * @param binaryName our expected name
91  * @param binaryHelp helptext for "-h" option (about the app)
92  * @param options command line options
93  * @param task main function to run
94  * @param task_cls closure for @a task
95  * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
96  */
97 int
98 GNUNET_PROGRAM_run (int argc,
99                     char *const *argv,
100                     const char *binaryName,
101                     const char *binaryHelp,
102                     const struct GNUNET_GETOPT_CommandLineOption *options,
103                     GNUNET_PROGRAM_Main task, void *task_cls);
104
105
106
107 #if 0                           /* keep Emacsens' auto-indent happy */
108 {
109 #endif
110 #ifdef __cplusplus
111 }
112 #endif
113
114 /** @} */ /* end of group program */
115
116 /* ifndef GNUNET_PROGRAM_LIB_H */
117 #endif
118 /* end of gnunet_program_lib.h */