diff options
Diffstat (limited to 'src/testing/testing_api_trait_truth_uuid.c')
-rw-r--r-- | src/testing/testing_api_trait_truth_uuid.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_truth_uuid.c b/src/testing/testing_api_trait_truth_uuid.c new file mode 100644 index 0000000..38a7336 --- /dev/null +++ b/src/testing/testing_api_trait_truth_uuid.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | This file is part of TALER | ||
3 | Copyright (C) 2020 Taler Systems SA | ||
4 | |||
5 | TALER is free software; you can redistribute it and/or modify it | ||
6 | under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | TALER 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public | ||
16 | License along with TALER; see the file COPYING. If not, see | ||
17 | <http://www.gnu.org/licenses/> | ||
18 | */ | ||
19 | /** | ||
20 | * @file lib/testing_api_trait_truth_pub.c | ||
21 | * @brief traits to offer a UUID for some truth | ||
22 | * @author Christian Grothoff | ||
23 | * @author Dominik Meister | ||
24 | * @author Dennis Neufeld | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "anastasis_testing_lib.h" | ||
28 | |||
29 | #define ANASTASIS_TESTING_TRAIT_TRUTH_UUID "anastasis-truth-uuid" | ||
30 | |||
31 | |||
32 | /** | ||
33 | * Obtain an public key from @a cmd. | ||
34 | * | ||
35 | * @param cmd command to extract the number from. | ||
36 | * @param index the number's index number. | ||
37 | * @param u[out] set to the number coming from @a cmd. | ||
38 | * @return #GNUNET_OK on success. | ||
39 | */ | ||
40 | int | ||
41 | ANASTASIS_TESTING_get_trait_truth_uuid | ||
42 | (const struct TALER_TESTING_Command *cmd, | ||
43 | unsigned int index, | ||
44 | const struct ANASTASIS_CRYPTO_TruthUUIDP **tpk) | ||
45 | { | ||
46 | return cmd->traits (cmd->cls, | ||
47 | (const void **) tpk, | ||
48 | ANASTASIS_TESTING_TRAIT_TRUTH_UUID, | ||
49 | index); | ||
50 | } | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Offer a truth public key. | ||
55 | * | ||
56 | * @param index the number's index number. | ||
57 | * @param tpk the public key to offer. | ||
58 | * @return #GNUNET_OK on success. | ||
59 | */ | ||
60 | struct TALER_TESTING_Trait | ||
61 | ANASTASIS_TESTING_make_trait_truth_uuid | ||
62 | (unsigned int index, | ||
63 | const struct ANASTASIS_CRYPTO_TruthUUIDP *tpk) | ||
64 | { | ||
65 | struct TALER_TESTING_Trait ret = { | ||
66 | .index = index, | ||
67 | .trait_name = ANASTASIS_TESTING_TRAIT_TRUTH_UUID, | ||
68 | .ptr = (const void *) tpk | ||
69 | }; | ||
70 | return ret; | ||
71 | } | ||
72 | |||
73 | |||
74 | /* end of testing_api_trait_truth_pub.c */ | ||