aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_trait_process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_trait_process.c')
-rw-r--r--src/testing/testing_api_trait_process.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_process.c b/src/testing/testing_api_trait_process.c
new file mode 100644
index 000000000..7d694e35d
--- /dev/null
+++ b/src/testing/testing_api_trait_process.c
@@ -0,0 +1,81 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 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
21/**
22 * @file testing/testing_api_trait_process.c
23 * @brief trait offering process handles.
24 * @author Christian Grothoff (GNU Taler testing)
25 * @author Marcello Stanisci (GNU Taler testing)
26 * @author t3sserakt
27 */
28#include "platform.h"
29#include "gnunet_testing_ng_lib.h"
30
31#define GNUNET_TESTING_TRAIT_PROCESS "process"
32
33
34/**
35 * Obtain location where a command stores a pointer to a process.
36 *
37 * @param cmd command to extract trait from.
38 * @param index which process to pick if @a cmd
39 * has multiple on offer.
40 * @param[out] processp set to the address of the pointer to the
41 * process.
42 * @return #GNUNET_OK on success.
43 */
44int
45GNUNET_TESTING_get_trait_process
46 (const struct GNUNET_TESTING_Command *cmd,
47 unsigned int index,
48 struct GNUNET_OS_Process ***processp)
49{
50 return cmd->traits (cmd->cls,
51 (const void **) processp,
52 GNUNET_TESTING_TRAIT_PROCESS,
53 index);
54}
55
56
57/**
58 * Offer location where a command stores a pointer to a process.
59 *
60 * @param index offered location index number, in case there are
61 * multiple on offer.
62 * @param processp process location to offer.
63 *
64 * @return the trait.
65 */
66struct GNUNET_TESTING_Trait
67GNUNET_TESTING_make_trait_process
68 (unsigned int index,
69 struct GNUNET_OS_Process **processp)
70{
71 struct GNUNET_TESTING_Trait ret = {
72 .index = index,
73 .trait_name = GNUNET_TESTING_TRAIT_PROCESS,
74 .ptr = (const void *) processp
75 };
76
77 return ret;
78}
79
80
81/* end of testing_api_trait_process.c */