GNUnet  0.10.x
transport-testing-loggers.c
Go to the documentation of this file.
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  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19  SPDX-License-Identifier: AGPL3.0-or-later
20  */
26 #include "transport-testing.h"
27 
28 
36 void
39  const struct GNUNET_PeerIdentity *other)
40 {
41  char *ps;
42 
43  ps = GNUNET_strdup(GNUNET_i2s(&me->id));
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 
61 void
64  const struct GNUNET_PeerIdentity *other)
65 {
66  char *ps;
67 
68  ps = GNUNET_strdup(GNUNET_i2s(&me->id));
70  "Peer `%s' disconnected from %u (%s)!\n",
71  GNUNET_i2s(other),
72  me->no,
73  ps);
74  GNUNET_free(ps);
75 }
76 
77 /* end of transport-testing-loggers.c */
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
struct GNUNET_PeerIdentity id
Peer identity.
Context for a single peer.
unsigned int no
An unique number to identify the peer.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
void GNUNET_TRANSPORT_TESTING_log_connect(void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other)
Log a connect event.
The identity of the host (wraps the signing key of the peer).
#define GNUNET_log(kind,...)
testing lib for transport service
void GNUNET_TRANSPORT_TESTING_log_disconnect(void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other)
Log a disconnect event.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_free(ptr)
Wrapper around free.