GNUnet 0.21.1
gnunet_transport_testing_ng_lib.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021-2023 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
25#ifndef GNUNET_TRANSPORT_TESTING_NG_LIB_H
26#define GNUNET_TRANSPORT_TESTING_NG_LIB_H
27
28
29#include "gnunet_util_lib.h"
31
36
41
42
43// FIXME: breaks naming conventions
44typedef void *
45(*GNUNET_TESTING_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is,
46 const struct GNUNET_PeerIdentity *peer);
47
48
49
50// FIXME: breaks naming conventions! Needed public?
52{
57
61 char *node_ip;
62
67
71 char *cfgname;
72
77
82
87
92
97
102
107
112
116 char *hello;
117
122
127
131 unsigned int no;
132
138
143
148
153};
154
155
156
170 const char *system_label,
171 uint32_t no,
172 const char *node_ip,
173 const char *cfgname,
174 unsigned int broadcast);
175
176
179 const char *start_label);
180
181
189struct GNUNET_PeerIdentity *
190GNUNET_TESTING_get_peer (unsigned int num,
191 const struct GNUNET_TESTING_System *tl_system);
192
193
194
195
199#define GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS(op, prefix) \
200 op (prefix, connected_peers_map, const struct GNUNET_CONTAINER_MultiShortmap) \
201 op (prefix, peer_id, const struct GNUNET_PeerIdentity) \
202 op (prefix, hello_size, const size_t) \
203 op (prefix, hello, const char) \
204 op (prefix, application_handle, const struct GNUNET_TRANSPORT_ApplicationHandle) \
205 op (prefix, state, const struct GNUNET_TESTING_StartPeerState) \
206 op (prefix, broadcast, const enum GNUNET_GenericReturnValue)
207
208
210
211#endif
struct GNUNET_TESTING_Interpreter * is
#define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(prefix, name, type)
Create headers for a trait with name name for statically allocated data of type type.
#define GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS(op, prefix)
Call op on all simple traits.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_stop_peer(const char *label, const char *start_label)
Create command.
struct GNUNET_PeerIdentity * GNUNET_TESTING_get_peer(unsigned int num, const struct GNUNET_TESTING_System *tl_system)
Retrieve peer identity from the test system with the unique node id.
Definition: testing.c:2276
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_start_peer(const char *label, const char *system_label, uint32_t no, const char *node_ip, const char *cfgname, unsigned int broadcast)
Create command.
void *(* GNUNET_TESTING_notify_connect_cb)(struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_PeerIdentity *peer)
GNUNET_GenericReturnValue
Named constants for return values.
Internal representation of the hash map.
Message handler for a specific message type.
Handle to the PEERSTORE service.
Definition: peerstore_api.c:46
Context for a iterate request.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Definition: scheduler.c:136
State each asynchronous command must have in its closure.
A command to be run by the interpreter.
struct GNUNET_TESTING_CommandLabel label
Label for the command.
Global state of the interpreter, used by a command to access information about other commands.
Handle for a GNUnet peer controlled by testing.
Definition: testing.c:195
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
struct GNUNET_PeerIdentity id
Peer identity.
struct GNUNET_PEERSTORE_IterateContext * pic
Peer's transport get hello handle to retrieve peer's HELLO message.
const struct GNUNET_TESTING_System * tl_system
Test setup for this peer.
struct GNUNET_TRANSPORT_ApplicationHandle * ah
Application handle.
struct GNUNET_CONFIGURATION_Handle * cfg
Peer's configuration.
struct GNUNET_MQ_MessageHandler * handlers
Receive callback.
char * system_label
The label of the command which was started by calling GNUNET_TESTING_cmd_system_create.
unsigned int no
An unique number to identify the peer.
struct GNUNET_CONTAINER_MultiShortmap * connected_peers_map
A map with struct GNUNET_MQ_Handle values for each peer this peer is connected to.
struct GNUNET_PEERSTORE_Handle * ph
Peer's PEERSTORE Handle.
struct GNUNET_TESTING_Peer * peer
struct GNUNET_TESTING_Peer returned by GNUNET_TESTING_peer_configure.
GNUNET_TESTING_notify_connect_cb notify_connect
Callback which is called on neighbour connect events.
enum GNUNET_GenericReturnValue broadcast
Flag indicating, if udp broadcast should be switched on.
struct GNUNET_TRANSPORT_CoreHandle * th
Peer's transport service handle.
struct GNUNET_SCHEDULER_Task * rh_task
Hello get task.
char * cfgname
GNUnet configuration file used to start a peer.
Handle for a system on which GNUnet peers are executed; a system is used for reserving unique paths a...
Definition: testing.c:122
Handle to the TRANSPORT subsystem for application management.
Handle for the transport service (includes all of the state for the transport service).