diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-07-16 18:58:55 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-07-16 18:58:55 +0000 |
commit | 717bd5e03fbc05b7bb1f621033eabb785750d03f (patch) | |
tree | cbc6b337381d93d3ef6d23ae98632e553fa35f14 /src/include/gnunet_helper_lib.h | |
parent | 5b0b4975c8c863e5948cfadafcfeb166655e4561 (diff) | |
download | gnunet-717bd5e03fbc05b7bb1f621033eabb785750d03f.tar.gz gnunet-717bd5e03fbc05b7bb1f621033eabb785750d03f.zip |
extended HELPER api to notify when child crashes
Diffstat (limited to 'src/include/gnunet_helper_lib.h')
-rw-r--r-- | src/include/gnunet_helper_lib.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h index 9c1bc21e2..2756cdf4e 100644 --- a/src/include/gnunet_helper_lib.h +++ b/src/include/gnunet_helper_lib.h | |||
@@ -24,6 +24,7 @@ | |||
24 | * @author Philipp Toelke | 24 | * @author Philipp Toelke |
25 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
26 | */ | 26 | */ |
27 | |||
27 | #ifndef GNUNET_HELPER_LIB_H | 28 | #ifndef GNUNET_HELPER_LIB_H |
28 | #define GNUNET_HELPER_LIB_H | 29 | #define GNUNET_HELPER_LIB_H |
29 | 30 | ||
@@ -37,24 +38,43 @@ struct GNUNET_HELPER_Handle; | |||
37 | 38 | ||
38 | 39 | ||
39 | /** | 40 | /** |
40 | * @brief Starts a helper and begins reading from it | 41 | * Callback that will be called when the helper process dies. This is not called |
42 | * when the helper process is stoped using GNUNET_HELPER_stop() | ||
43 | * | ||
44 | * @param cls the closure from GNUNET_HELPER_start() | ||
45 | * @param h the handle representing the helper process. This handle is invalid | ||
46 | * in this callback. It is only presented for reference. No operations | ||
47 | * can be performed using it. | ||
48 | */ | ||
49 | typedef void (*GNUNET_HELPER_ExceptionCallback) (void *cls, | ||
50 | const struct GNUNET_HELPER_Handle *h); | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Starts a helper and begins reading from it. The helper process is | ||
55 | * restarted when it dies except when it is stopped using GNUNET_HELPER_stop() | ||
56 | * or when the exp_cb callback is not NULL. | ||
41 | * | 57 | * |
42 | * @param binary_name name of the binary to run | 58 | * @param binary_name name of the binary to run |
43 | * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this | 59 | * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this |
44 | * argument must not be modified by the client for | 60 | * argument must not be modified by the client for |
45 | * the lifetime of the helper handle) | 61 | * the lifetime of the helper handle) |
46 | * @param cb function to call if we get messages from the helper | 62 | * @param cb function to call if we get messages from the helper |
47 | * @param cb_cls Closure for the callback | 63 | * @param exp_cb the exception callback to call. Set this to NULL if the helper |
64 | * process has to be restarted automatically when it dies/crashes | ||
65 | * @param cb_cls closure for the above callbacks | ||
48 | * @return the new Handle, NULL on error | 66 | * @return the new Handle, NULL on error |
49 | */ | 67 | */ |
50 | struct GNUNET_HELPER_Handle * | 68 | struct GNUNET_HELPER_Handle * |
51 | GNUNET_HELPER_start (const char *binary_name, | 69 | GNUNET_HELPER_start (const char *binary_name, |
52 | char *const binary_argv[], | 70 | char *const binary_argv[], |
53 | GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls); | 71 | GNUNET_SERVER_MessageTokenizerCallback cb, |
72 | GNUNET_HELPER_ExceptionCallback exp_cb, | ||
73 | void *cb_cls); | ||
54 | 74 | ||
55 | 75 | ||
56 | /** | 76 | /** |
57 | * @brief Kills the helper, closes the pipe and frees the handle | 77 | * Kills the helper, closes the pipe and frees the handle |
58 | * | 78 | * |
59 | * @param h handle to helper to stop | 79 | * @param h handle to helper to stop |
60 | */ | 80 | */ |