aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing-loggers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing-loggers.c')
-rw-r--r--src/transport/transport-testing-loggers.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/transport/transport-testing-loggers.c b/src/transport/transport-testing-loggers.c
new file mode 100644
index 000000000..de9fa91c1
--- /dev/null
+++ b/src/transport/transport-testing-loggers.c
@@ -0,0 +1,76 @@
1
2/*
3 This file is part of GNUnet.
4 Copyright (C) 2016 GNUnet e.V.
5
6 GNUnet is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 3, or (at your
9 option) any later version.
10
11 GNUnet is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNUnet; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21/**
22 * @file transport-testing-loggers.c
23 * @brief convenience functions for logging common events in tests
24 * @author Christian Grothoff
25 */
26#include "transport-testing.h"
27
28
29/**
30 * Log a connect event.
31 *
32 * @param cls NULL
33 * @param me peer that had the event
34 * @param other peer that connected.
35 */
36void
37GNUNET_TRANSPORT_TESTING_log_connect (void *cls,
38 struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
39 const struct GNUNET_PeerIdentity *other)
40{
41 char *ps;
42
43 ps = GNUNET_strdup (GNUNET_i2s (&me->id));
44 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
45 "Peer %s connected to %u (%s)!\n",
46 GNUNET_i2s (other),
47 me->no,
48 ps);
49 GNUNET_free (ps);
50}
51
52
53
54/**
55 * Log a disconnect event.
56 *
57 * @param cls NULL
58 * @param me peer that had the event
59 * @param other peer that disconnected.
60 */
61void
62GNUNET_TRANSPORT_TESTING_log_disconnect (void *cls,
63 struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
64 const struct GNUNET_PeerIdentity *other)
65{
66 char *ps;
67
68 ps = GNUNET_strdup (GNUNET_i2s (&me->id));
69 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
70 "Peer `%s' disconnected from %u (%s)!\n",
71 GNUNET_i2s (other),
72 me->no,
73 ps);
74}
75
76/* end of transport-testing-loggers.c */