service for collecting messages and writing to a file More...
Go to the source code of this file.
Macros | |
#define | LOG(type, ...) GNUNET_log (type, __VA_ARGS__) |
Generic logging shorthand. More... | |
#define | LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
Debug logging shorthand. More... | |
Functions | |
static int | check_log_msg (void *cls, const struct GNUNET_MessageHeader *msg) |
Check GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG messages. More... | |
static void | handle_log_msg (void *cls, const struct GNUNET_MessageHeader *msg) |
Message handler for GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG messages. More... | |
static void | shutdown_task (void *cls) |
Task to clean up and shutdown nicely. More... | |
static void * | client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *c, struct GNUNET_MQ_Handle *mq) |
Callback called when a client connects to the service. More... | |
static void | client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *c, void *internal_cls) |
Callback called when a client disconnected from the service. More... | |
static void | logger_run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service) |
Testbed setup. More... | |
GNUNET_SERVICE_MAIN ("testbed-logger", GNUNET_SERVICE_OPTION_NONE, &logger_run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size(log_msg, GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_handler_end()) | |
Define "main" method using service macro. More... | |
Variables | |
struct GNUNET_BIO_WriteHandle * | bio |
Handle for buffered writing. More... | |
static unsigned int | nconn |
The number of connections we have. More... | |
static int | in_shutdown |
Are we shutting down? More... | |
service for collecting messages and writing to a file
Definition in file gnunet-service-testbed-logger.c.
#define LOG | ( | type, | |
... | |||
) | GNUNET_log (type, __VA_ARGS__) |
Generic logging shorthand.
Definition at line 33 of file gnunet-service-testbed-logger.c.
#define LOG_DEBUG | ( | ... | ) | LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
Debug logging shorthand.
Definition at line 39 of file gnunet-service-testbed-logger.c.
|
static |
Check GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG messages.
cls | client identification of the client |
msg | the actual message |
Definition at line 66 of file gnunet-service-testbed-logger.c.
References GNUNET_OK.
|
static |
Message handler for GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG messages.
cls | client identification of the client |
msg | the actual message |
Definition at line 80 of file gnunet-service-testbed-logger.c.
References bio, GNUNET_BIO_write(), GNUNET_SERVICE_client_continue(), msg, and GNUNET_MessageHeader::size.
|
static |
Task to clean up and shutdown nicely.
cls | NULL |
Definition at line 101 of file gnunet-service-testbed-logger.c.
References bio, GNUNET_BIO_write_close(), GNUNET_break, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_YES, in_shutdown, and nconn.
Referenced by logger_run().
|
static |
Callback called when a client connects to the service.
cls | closure for the service |
c | the new client that connected to the service |
mq | the message queue used to send messages to the client |
Definition at line 125 of file gnunet-service-testbed-logger.c.
References GNUNET_SERVICE_client_persist(), and nconn.
|
static |
Callback called when a client disconnected from the service.
cls | closure for the service |
c | the client that disconnected |
internal_cls | should be equal to c |
Definition at line 144 of file gnunet-service-testbed-logger.c.
References GNUNET_assert, GNUNET_SCHEDULER_shutdown(), GNUNET_YES, in_shutdown, and nconn.
|
static |
Testbed setup.
cls | closure |
cfg | configuration to use |
service | the initialized service |
Definition at line 163 of file gnunet-service-testbed-logger.c.
References bio, cfg, dir, GNUNET_asprintf(), GNUNET_BIO_write_open_file(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log_config_missing(), GNUNET_malloc, GNUNET_OK, GNUNET_OS_get_hostname_max_length, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), LOG, LOG_DEBUG, pid, and shutdown_task().
GNUNET_SERVICE_MAIN | ( | "testbed-logger" | , |
GNUNET_SERVICE_OPTION_NONE | , | ||
& | logger_run, | ||
& | client_connect_cb, | ||
& | client_disconnect_cb, | ||
NULL | , | ||
GNUNET_MQ_hd_var_size(log_msg, GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG, struct GNUNET_MessageHeader, NULL) | , | ||
GNUNET_MQ_handler_end() | |||
) |
Define "main" method using service macro.
struct GNUNET_BIO_WriteHandle* bio |
Handle for buffered writing.
Definition at line 45 of file gnunet-service-testbed-logger.c.
Referenced by handle_log_msg(), logger_run(), and shutdown_task().
|
static |
The number of connections we have.
Definition at line 50 of file gnunet-service-testbed-logger.c.
Referenced by client_connect_cb(), client_disconnect_cb(), and shutdown_task().
|
static |
Are we shutting down?
Definition at line 55 of file gnunet-service-testbed-logger.c.
Referenced by client_disconnect_cb(), and shutdown_task().