GNUnet 0.22.0
gnunet_testing_transport_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"
30#include "gnunet_testing_lib.h"
31
36
37
38// FIXME: breaks naming conventions
39typedef void *
40(*GNUNET_TESTING_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is,
41 const struct GNUNET_PeerIdentity *peer);
42
43
44// FIXME: breaks naming conventions! Needed public?
46{
51
55 char *node_ip;
56
61
65 char *cfgname;
66
71
75 struct GNUNET_TESTING_Peer *peer;
76
81
86
91
96
101
106
111
116
121
126
130 FILE *stream;
131
136
141
146
150 unsigned int num_coms_started;
151
155 char *hello;
156
161
166
170 unsigned int no;
171
177
181 const struct GNUNET_TESTING_System *tl_system;
182
187
192};
193
194
208 const char *system_label,
209 uint32_t no,
210 const char *node_ip,
211 const char *cfgname,
212 unsigned int broadcast);
213
214
217 const char *start_label);
218
219
227struct GNUNET_PeerIdentity *
228GNUNET_TESTING_get_peer (unsigned int num,
229 const struct GNUNET_TESTING_System *tl_system);
230
231
235#define GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS(op, prefix) \
236 op (prefix, connected_peers_map, const struct \
237 GNUNET_CONTAINER_MultiShortmap) \
238 op (prefix, peer_id, const struct GNUNET_PeerIdentity) \
239 op (prefix, hello_size, const size_t) \
240 op (prefix, hello, const char) \
241 op (prefix, application_handle, const struct \
242 GNUNET_TRANSPORT_ApplicationHandle) \
243 op (prefix, state, const struct GNUNET_TESTING_StartPeerState) \
244 op (prefix, broadcast, const enum GNUNET_GenericReturnValue)
245
246
248 GNUNET_TRANSPORT_TESTING)
249
250#endif
static 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.
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.
Handle for interacting with ARM.
Definition: arm_api.c:103
Entry in a doubly-linked list of operations awaiting for replies (in-order) from the ARM service.
Definition: arm_api.c:41
Internal representation of the hash map.
Handle used to access files (and pipes).
Message handler for a specific message type.
Handle to the PEERSTORE service.
Definition: peerstore_api.c:44
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:135
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 peer controlled via ARM.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
struct GNUNET_PeerIdentity id
Peer identity.
unsigned int num_coms_started
Number of communicators connecteds with transport service.
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_MQ_MessageHandler * handlers
Receive callback.
struct GNUNET_SCHEDULER_Task * log_task
Task to search for log entry indicating the communicators started.
FILE * stream
Stream to read log file lines.
char * system_label
The label of the command which was started by calling GNUNET_TESTING_cmd_system_create.
enum GNUNET_GenericReturnValue coms_started
Flag indicating if all (udo and tcp) communicators connected to transport service.
struct GNUNET_ARM_Handle * h
Handle for the arm service.
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.
enum GNUNET_GenericReturnValue not_all_started
Flag indicating, if there are services not started completely.
struct GNUNET_SCHEDULER_Task * request_task
Task to start the request for the list of services.
struct GNUNET_DISK_FileHandle * fh
File handle for log file.
struct GNUNET_PEERSTORE_Handle * ph
Peer's PEERSTORE Handle.
struct GNUNET_TESTING_Peer * peer
struct GNUNET_TESTING_Peer returned by GNUNET_TESTING_peer_configure.
struct GNUNET_ARM_Operation * op
Arm operation to get a list of the services, to check if all started.
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_CONFIGURATION_Handle * cfg
Peer's configuration.
struct GNUNET_SCHEDULER_Task * rh_task
Hello get task.
char * cfgname
GNUnet configuration file used to start a peer.
Handle to the TRANSPORT subsystem for application management.
Handle for the transport service (includes all of the state for the transport service).