aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_helper_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-02 09:26:10 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-02 09:26:10 +0000
commit1ac29e62ba9db3cac4d382a6ab629d6249cf58ad (patch)
tree5d66ae45dc4f62128625a1a365dc079f524d170c /src/include/gnunet_helper_lib.h
parentf1f198df545fbb423a61dc2fa945fe97bdcfe098 (diff)
downloadgnunet-1ac29e62ba9db3cac4d382a6ab629d6249cf58ad.tar.gz
gnunet-1ac29e62ba9db3cac4d382a6ab629d6249cf58ad.zip
adding new GNUNET_HELPER_ API for communication with (SUID) helper binaries via stdin/stdout using standard GNUNET messages
Diffstat (limited to 'src/include/gnunet_helper_lib.h')
-rw-r--r--src/include/gnunet_helper_lib.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h
new file mode 100644
index 000000000..7115748fc
--- /dev/null
+++ b/src/include/gnunet_helper_lib.h
@@ -0,0 +1,96 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff
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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file include/gnunet_helper_lib.h
23 * @brief API for dealing with (SUID) helper processes that communicate via GNUNET_MessageHeaders on stdin/stdout
24 * @author Philipp Toelke
25 * @author Christian Grothoff
26 */
27#ifndef GNUNET_HELPER_LIB_H
28#define GNUNET_HELPER_LIB_H
29
30#include "gnunet_scheduler_lib.h"
31#include "gnunet_server_lib.h"
32
33/**
34 * The handle to a helper process.
35 */
36struct GNUNET_HELPER_Handle;
37
38
39/**
40 * @brief Starts a helper and begins reading from it
41 *
42 * @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
44 * argument must not be modified by the client for
45 * the lifetime of the helper handle)
46 * @param cb function to call if we get messages from the helper
47 * @param cb_cls Closure for the callback
48 * @return the new Handle, NULL on error
49 */
50struct GNUNET_HELPER_Handle *
51GNUNET_HELPER_start (const char *binary_name,
52 char *const binary_argv[],
53 GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls);
54
55
56/**
57 * @brief Kills the helper, closes the pipe and frees the handle
58 *
59 * @param h handle to helper to stop
60 */
61void
62GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h);
63
64
65/**
66 * Continuation function.
67 *
68 * @param cls closure
69 * @param result GNUNET_OK on success,
70 * GNUNET_NO if helper process died
71 * GNUNET_SYSERR during GNUNET_HELPER_stop
72 */
73typedef void (*GNUNET_HELPER_Continuation)(void *cls,
74 int result);
75
76
77/**
78 * Send an message to the helper.
79 *
80 * @param h helper to send message to
81 * @param msg message to send
82 * @param can_drop can the message be dropped if there is already one in the queue?
83 * @param cont continuation to run once the message is out
84 * @param cont_cls closure for 'cont'
85 * @return GNUNET_YES if the message will be sent
86 * GNUNET_NO if the message was dropped
87 */
88int
89GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
90 const struct GNUNET_MessageHeader *msg,
91 int can_drop,
92 GNUNET_HELPER_Continuation cont,
93 void *cont_cls);
94
95
96#endif /* end of include guard: GNUNET_HELPER_LIB_H */