adding a GNUNET_memcmp_priv for constant-time comparing of data; fixes #6152 (modulo...
[oweals/gnunet.git] / src / transport / transport-testing-loggers.c
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2016 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your 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      Affero General Public License for more details.
14
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18      SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 /**
21  * @file transport-testing-loggers.c
22  * @brief convenience functions for logging common events in tests
23  * @author Christian Grothoff
24  */
25 #include "transport-testing.h"
26
27
28 /**
29  * Log a connect event.
30  *
31  * @param cls NULL
32  * @param me peer that had the event
33  * @param other peer that connected.
34  */
35 void
36 GNUNET_TRANSPORT_TESTING_log_connect (void *cls,
37                                       struct
38                                       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  * Log a disconnect event.
55  *
56  * @param cls NULL
57  * @param me peer that had the event
58  * @param other peer that disconnected.
59  */
60 void
61 GNUNET_TRANSPORT_TESTING_log_disconnect (void *cls,
62                                          struct
63                                          GNUNET_TRANSPORT_TESTING_PeerContext *
64                                          me,
65                                          const struct
66                                          GNUNET_PeerIdentity *other)
67 {
68   char *ps;
69
70   ps = GNUNET_strdup (GNUNET_i2s (&me->id));
71   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
72               "Peer `%s' disconnected from %u (%s)!\n",
73               GNUNET_i2s (other),
74               me->no,
75               ps);
76   GNUNET_free (ps);
77 }
78
79
80 /* end of transport-testing-loggers.c */