glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / transport / transport-testing-loggers.c
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 it
7      under the terms of the GNU Affero General Public License as published
8      by the Free Software Foundation, either version 3 of the License,
9      or (at your 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      Affero General Public License for more details.
15 */
16 /**
17  * @file transport-testing-loggers.c
18  * @brief convenience functions for logging common events in tests
19  * @author Christian Grothoff
20  */
21 #include "transport-testing.h"
22
23
24 /**
25  * Log a connect event.
26  *
27  * @param cls NULL
28  * @param me peer that had the event
29  * @param other peer that connected.
30  */
31 void
32 GNUNET_TRANSPORT_TESTING_log_connect (void *cls,
33                                       struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
34                                       const struct GNUNET_PeerIdentity *other)
35 {
36   char *ps;
37
38   ps = GNUNET_strdup (GNUNET_i2s (&me->id));
39   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
40               "Peer %s connected to %u (%s)!\n",
41               GNUNET_i2s (other),
42               me->no,
43               ps);
44   GNUNET_free (ps);
45 }
46
47
48
49 /**
50  * Log a disconnect event.
51  *
52  * @param cls NULL
53  * @param me peer that had the event
54  * @param other peer that disconnected.
55  */
56 void
57 GNUNET_TRANSPORT_TESTING_log_disconnect (void *cls,
58                                          struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
59                                          const struct GNUNET_PeerIdentity *other)
60 {
61   char *ps;
62
63   ps = GNUNET_strdup (GNUNET_i2s (&me->id));
64   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
65               "Peer `%s' disconnected from %u (%s)!\n",
66               GNUNET_i2s (other),
67               me->no,
68               ps);
69   GNUNET_free (ps);
70 }
71
72 /* end of transport-testing-loggers.c */