GNUnet debian-0.24.3-28-g4f2a77692
 
Loading...
Searching...
No Matches
gnunet_testing_core_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_TESTING_CORE_LIB_H
26#define GNUNET_TESTING_CORE_LIB_H
27
28
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_lib.h"
31
32
33#define MTYPE 12345
34
35#define NODE_ID_LEN 16
36
37
41// FIXME: breaks naming conventions
127
128
130
131
140
141
143{
145 // The following will be used for debugging
146 uint64_t id; // id of the message
147 uint64_t batch; // first batch of that peer (for this test 0 or 1)
148 //uint64_t peer; // number of sending peer (for this test 0 or 1)
150};
151
152
153typedef void *
154(*GNUNET_TESTING_CORE_connect_cb) (
155 void *cls,
156 const struct GNUNET_PeerIdentity *peer_id,
157 struct GNUNET_MQ_Handle *mq);
158
159
165
166
167typedef void
169 void *cls,
170 struct GNUNET_TESTING_CORE_Channel *channel,
171 const struct GNUNET_TESTING_CORE_Message *msg);
172
173
202
203
218 const char *label,
219 const char *start_peer_label,
220 const char *create_label,
221 uint32_t num,
222 struct GNUNET_TESTING_NetjailTopology *topology,
223 unsigned int additional_connects,
224 unsigned int wait_for_connect,
226
227const struct GNUNET_TESTING_Command
229 const char *label,
230 const char* node_id,
231 char *arm_service_label);
232
233
234const struct GNUNET_TESTING_Command
236 const char *label,
237 uint64_t num_messages);
238
239
240const struct GNUNET_TESTING_Command
242 const char *label,
243 uint64_t num_messages,
244 enum GNUNET_GenericReturnValue await_new_connection);
245
246
250#define GNUNET_CORE_TESTING_SIMPLE_TRAITS(op, prefix) \
251 op (prefix, connect_peer_state, const struct \
252 GNUNET_TESTING_ConnectPeersState) \
253 op (prefix, connect, const struct \
254 GNUNET_TESTING_CORE_ConnectState)
255
257 GNUNET_CORE_TESTING)
258
259
260#endif
struct GNUNET_MQ_MessageHandlers handlers[]
Definition 003.c:1
struct GNUNET_MessageHeader * msg
Definition 005.c:2
static char * peer_id
Option –peer.
void *(* GNUNET_TESTING_CORE_connect_cb)(void *cls, const struct GNUNET_PeerIdentity *peer_id, struct GNUNET_MQ_Handle *mq)
struct GNUNET_TESTING_Command GNUNET_CORE_cmd_connect_peers(const char *label, const char *start_peer_label, const char *create_label, uint32_t num, struct GNUNET_TESTING_NetjailTopology *topology, unsigned int additional_connects, unsigned int wait_for_connect, struct GNUNET_MQ_MessageHandler *handlers)
FIXME: document properly! Create command.
const struct GNUNET_TESTING_Command GNUNET_TESTING_CORE_cmd_connect(const char *label, const char *node_id, char *arm_service_label)
void(* GNUNET_TESTING_CORE_handle_msg)(void *cls, struct GNUNET_TESTING_CORE_Channel *channel, const struct GNUNET_TESTING_CORE_Message *msg)
const struct GNUNET_TESTING_Command GNUNET_TESTING_CORE_cmd_send(const char *label, uint64_t num_messages, enum GNUNET_GenericReturnValue await_new_connection)
const struct GNUNET_TESTING_Command GNUNET_TESTING_CORE_cmd_recv(const char *label, uint64_t num_messages)
#define NODE_ID_LEN
#define GNUNET_CORE_TESTING_SIMPLE_TRAITS(op, prefix)
Call op on all simple traits.
#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.
GNUNET_GenericReturnValue
Named constants for return values.
static struct GNUNET_MQ_Handle * mq
Our connection to the resolver service, created on-demand, but then persists until error or shutdown.
Internal representation of the hash map.
Context for the core service connection.
Definition core_api.c:78
Handle to a message queue.
Definition mq.c:87
Message handler for a specific message type.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Handle for a system on which GNUnet peers are executed; a system is used for reserving unique paths a...
Definition testbed.c:54
State each asynchronous command must have in its closure.
struct GNUNET_TESTING_CORE_Channel * prev
struct GNUNET_TESTING_CORE_ConnectState * connect_state
struct GNUNET_PeerIdentity peer_id
struct GNUNET_TESTING_CORE_Channel * next
GNUNET_TESTING_CORE_connect_cb callback
struct GNUNET_TESTING_CORE_ConnectCb * connect_cbs
Connect callback TODO we probably only need a single one.
GNUNET_TESTING_CORE_handle_msg * recv_handlers
Receive callback.
struct GNUNET_TESTING_AsyncContext ac
struct GNUNET_TESTING_CORE_Channel * channels_tail
struct GNUNET_TESTING_CORE_Channel * channels_head
enum GNUNET_GenericReturnValue finished
const struct GNUNET_CONFIGURATION_Handle * cfg
struct GNUNET_MessageHeader header
A command to be run by the interpreter.
struct GNUNET_TESTING_CommandLabel label
Label for the command.
Struct to store information needed in callbacks.
uint32_t num
Number globally identifying the node.
unsigned int con_num_notified
Number of connections we already have a notification for.
const struct GNUNET_TESTBED_System * tl_system
The testing system of this node.
unsigned int additional_connects
Number of additional connects this cmd will wait for not triggered by this cmd.
struct GNUNET_TESTING_Interpreter * is
unsigned int wait_for_connect
Flag indicating, whether the command is waiting for peers to connect that are configured to connect.
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_MQ_MessageHandler * handlers
Receive callback.
unsigned int additional_connects_notified
Number of additional connects this cmd will wait for not triggered by this cmd we already have a noti...
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
unsigned int con_num
Number of connections.
const char * start_peer_label
Label of the cmd to start a peer.
struct GNUNET_TRANSPORT_ApplicationHandle * ah
Handle for transport.
struct GNUNET_TESTING_NodeConnection * node_connections_head
Connections to other peers.
struct GNUNET_TRANSPORT_CoreHandle * th
Core handle.
struct GNUNET_TESTING_NetjailTopology * topology
The topology of the test setup.
Global state of the interpreter, used by a command to access information about other commands.
Topology of our netjail setup.
unsigned int additional_connects
Additional connects we do expect, beside the connects which are configured in the topology.
Connection to another node.
Handle to the TRANSPORT subsystem for application management.
Handle for the transport service (includes all of the state for the transport service).