2 This file is part of GNUnet
3 Copyright (C) 2008--2013 GNUnet e.V.
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.
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.
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.
22 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 * API for submitting data to the testbed logger service
27 * @defgroup testbed-logger Testbed Logger service
28 * Submit data to the testbed logger service.
32 #ifndef GNUNET_TESTBED_LOGGER_SERVICE_H
33 #define GNUNET_TESTBED_LOGGER_SERVICE_H
38 #if 0 /* keep Emacsens' auto-indent happy */
43 #include "gnunet_configuration_lib.h"
46 * Opaque handle for the logging service
48 struct GNUNET_TESTBED_LOGGER_Handle;
52 * Connect to the testbed logger service
54 * @param cfg configuration to use
55 * @return the handle which can be used for sending data to the service; NULL
58 struct GNUNET_TESTBED_LOGGER_Handle *
59 GNUNET_TESTBED_LOGGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
63 * Disconnect from the logger service. Also cancels any pending send handles.
65 * @param h the logger handle
68 GNUNET_TESTBED_LOGGER_disconnect (struct GNUNET_TESTBED_LOGGER_Handle *h);
72 * Functions of this type are called to notify a successful transmission of the
73 * message to the logger service
75 * @param cls the closure given to GNUNET_TESTBED_LOGGER_send()
76 * @param size the amount of data sent
78 typedef void (*GNUNET_TESTBED_LOGGER_FlushCompletion) (void *cls, size_t size);
82 * Send data to be logged to the logger service. The data will be buffered and
83 * will be sent upon an explicit call to GNUNET_TESTBED_LOGGER_flush() or upon
84 * exceeding a threshold size.
86 * @param h the logger handle
87 * @param data the data to send;
88 * @param size how many bytes of data to send
91 GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h,
92 const void *data, size_t size);
96 * Flush the buffered data to the logger service
98 * @param h the logger handle
99 * @param timeout how long to wait before calling the flust completion callback
100 * @param cb the callback to call after the data is flushed
101 * @param cb_cls the closure for the above callback
104 GNUNET_TESTBED_LOGGER_flush (struct GNUNET_TESTBED_LOGGER_Handle *h,
105 struct GNUNET_TIME_Relative timeout,
106 GNUNET_TESTBED_LOGGER_FlushCompletion cb,
111 * Cancel notification upon flush. Should only be used when the flush
112 * completion callback given to GNUNET_TESTBED_LOGGER_flush() is not already
115 * @param h the logger handle
118 GNUNET_TESTBED_LOGGER_flush_cancel (struct GNUNET_TESTBED_LOGGER_Handle *h);
121 #if 0 /* keep Emacsens' auto-indent happy */
128 #endif /* GNUNET_TESTBED_LOGGER_SERVICE_H */
130 /** @} */ /* end of group */
132 /* End of gnunet_testbed_logger_service.h */