GNUnet 0.22.1
testing_messenger_cmd_stop_service.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 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
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
31
33{
35};
36
39 const struct GNUNET_HashCode *key,
40 void *value)
41{
42 struct GNUNET_MESSENGER_RoomState *rs = cls;
44 return GNUNET_YES;
45}
46
47
48static void
51{
52 struct GNUNET_MESSENGER_StopServiceState *stop_ss = cls;
53
54 const struct GNUNET_TESTING_Command *service_cmd;
56 stop_ss->
57 service_label);
58
60 GNUNET_MESSENGER_get_trait_state (service_cmd, &sss);
61
63 sss->msg = NULL;
64
67 sss->rooms = NULL;
68}
69
70
71static void
73{
74 struct GNUNET_MESSENGER_StopServiceState *sss = cls;
75
77 GNUNET_free (sss);
78}
79
80
83 const char *service_label)
84{
86
89
91 label,
94 NULL);
95}
static struct GNUNET_TESTING_Interpreter * is
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command(struct GNUNET_TESTING_Interpreter *is, const char *label)
Lookup command by label.
#define GNUNET_TESTING_command_new(cls, label, run, cleanup, traits)
Create a new command.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_YES
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MESSENGER_disconnect(struct GNUNET_MESSENGER_Handle *handle)
Disconnect all of the messengers used services and clears up its used memory.
testing lib for messenger service
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_get_trait_state(const struct GNUNET_TESTING_Command *cmd, struct GNUNET_MESSENGER_StartServiceState **ret)
A 512-bit hashcode.
struct GNUNET_MESSENGER_Handle * msg
struct GNUNET_CONTAINER_MultiHashMap * rooms
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.
void GNUNET_MESSENGER_destroy_room_state(struct GNUNET_MESSENGER_RoomState *room_state)
static void stop_service_cleanup(void *cls)
struct GNUNET_TESTING_Command GNUNET_MESSENGER_cmd_stop_service(const char *label, const char *service_label)
static enum GNUNET_GenericReturnValue cleanup_rooms_cb(void *cls, const struct GNUNET_HashCode *key, void *value)
static void stop_service_run(void *cls, struct GNUNET_TESTING_Interpreter *is)