aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testbed_logger_service.h
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-04-19 11:03:01 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-04-19 11:03:01 +0000
commit487befc38de9c1faefb095f93886804e3012c675 (patch)
tree8d606ef9d2a1ef0cbd40641ff217165e981736df /src/include/gnunet_testbed_logger_service.h
parent5413b05b7061ff9f20346e48e93cb46201abda25 (diff)
downloadgnunet-487befc38de9c1faefb095f93886804e3012c675.tar.gz
gnunet-487befc38de9c1faefb095f93886804e3012c675.zip
- testbed logger client API
Diffstat (limited to 'src/include/gnunet_testbed_logger_service.h')
-rw-r--r--src/include/gnunet_testbed_logger_service.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/src/include/gnunet_testbed_logger_service.h b/src/include/gnunet_testbed_logger_service.h
new file mode 100644
index 000000000..c8b4b7762
--- /dev/null
+++ b/src/include/gnunet_testbed_logger_service.h
@@ -0,0 +1,131 @@
1/*
2 This file is part of GNUnet
3 (C) 2008--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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21/**
22 * @file include/gnunet_testbed_logger_service.h
23 * @brief API for submitting data to the testbed logger service
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */
26
27#ifndef GNUNET_TESTBED_LOGGER_SERVICE_H
28#define GNUNET_TESTBED_LOGGER_SERVICE_H
29
30#ifdef __cplusplus
31extern "C"
32{
33#if 0 /* keep Emacsens' auto-indent happy */
34}
35#endif
36#endif
37
38#include "gnunet_configuration_lib.h"
39
40/**
41 * Opaque handle for the logging service
42 */
43struct GNUNET_TESTBED_LOGGER_Handle;
44
45
46/**
47 * Connect to the testbed logger service
48 *
49 * @param cfg configuration to use
50 * @return the handle which can be used for sending data to the service; NULL
51 * upon any error
52 */
53struct GNUNET_TESTBED_LOGGER_Handle *
54GNUNET_TESTBED_LOGGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
55
56
57/**
58 * Disconnect from the logger service. Also cancels any pending send handles.
59 *
60 * @param h the logger handle
61 */
62void
63GNUNET_TESTBED_LOGGER_disconnect (struct GNUNET_TESTBED_LOGGER_Handle *h);
64
65
66/**
67 * Opaque handle representing a send request
68 */
69struct GNUNET_TESTBED_LOGGER_SendHandle;
70
71
72/**
73 * Functions of this type are called to notify a successful transmission of the
74 * message to the logger service
75 *
76 * @param cls the closure given to GNUNET_TESTBED_LOGGER_send()
77 * @param size the amount of data sent
78 */
79typedef void (*GNUNET_TESTBED_LOGGER_FlushCompletion) (void *cls, size_t size);
80
81
82/**
83 * Send data to be logged to the logger service. The data will be buffered and
84 * will be sent upon an explicit call to GNUNET_TESTBED_LOGGER_flush() or upon
85 * exceeding a threshold size.
86 *
87 * @param h the logger handle
88 * @param data the data to send;
89 * @param size how many bytes of data to send
90 * @param cb the callback to be called upon completion of the send request
91 * @param cb_cls the closure for the above callback
92 * @return the send handle which can used for cancelling the send operation.
93 * Will be invalid if upon call to completion callback
94 */
95void
96GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h,
97 const void *data, size_t size);
98
99
100/**
101 * Flush the buffered data to the logger service
102 *
103 * @param h the logger handle
104 * @param cb the callback to call after the data is flushed
105 * @param cb_cls the closure for the above callback
106 */
107void
108GNUNET_TESTBED_LOGGER_flush (struct GNUNET_TESTBED_LOGGER_Handle *h,
109 GNUNET_TESTBED_LOGGER_FlushCompletion cb,
110 void *cb_cls);
111
112
113/**
114 * Cancel notification upon flush.
115 *
116 * @param h the logger handle
117 */
118void
119GNUNET_TESTBED_LOGGER_flush_cancel (struct GNUNET_TESTBED_LOGGER_Handle *h);
120
121
122#if 0 /* keep Emacsens' auto-indent happy */
123{
124#endif
125#ifdef __cplusplus
126}
127#endif
128
129#endif /* GNUNET_TESTBED_LOGGER_SERVICE_H */
130
131/* End of gnunet_testbed_logger_service.h */