GNUnet  0.11.x
testbed_api_cmd_peer_store.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2021 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 
28 static void
30  const struct GNUNET_TESTING_Command *cmd,
32 {
33  struct PeerStoreState *pss = cls;
34 
35  pss->psh = GNUNET_PEERSTORE_connect (pss->cfg);
36  GNUNET_TESTING_interpreter_next (ps->is);
37 }
38 
39 
43 {
44 
45  struct PeerStoreState *pss;
46 
47  pss = GNUNET_new (struct PeerStoreState);
48  pss->cfg = cfg;
49 
50  struct GNUNET_TESTING_Command cmd = {
51  .cls = pss,
52  .label = label,
53  .run = &peer_store_run,
54  .cleanup = &peer_store_cleanup,
55  .traits = &peer_store_traits
56  };
57 
58  return cmd;
59 
60 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
struct GNUNET_TESTING_Command GNUNET_TESTBED_cmd_peer_store(const char *label, struct GNUNET_CONFIGURATION_Handle *cfg)
static void service_run(void *cls, const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_Interpreter *is)
const char * label
Label for the command.
A command to be run by the interpreter.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Global state of the interpreter, used by a command to access information about other commands...
Definition: testing.h:34
struct GNUNET_TESTING_Interpreter * is
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
configuration data
void * cls
Closure for all commands with command-specific context information.