aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/reclaim_api.c
diff options
context:
space:
mode:
authorMarkus Voggenreiter <Markus.Voggenreiter@tum.de>2019-10-23 21:50:46 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-01-13 13:31:03 +0100
commitbb286cb253251e8210ed686dbde3dc8ecee16420 (patch)
tree4e7f625480adb0397df002f6e26bb6a3755ff3cc /src/reclaim/reclaim_api.c
parentc136a16600cd4f72d7def1af7b4aa7592310c898 (diff)
downloadgnunet-bb286cb253251e8210ed686dbde3dc8ecee16420.tar.gz
gnunet-bb286cb253251e8210ed686dbde3dc8ecee16420.zip
Preparation for Reference Type
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r--src/reclaim/reclaim_api.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index 860a0f0ab..a6ff0237d 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -1118,6 +1118,53 @@ GNUNET_RECLAIM_attestation_delete (
1118} 1118}
1119 1119
1120/** 1120/**
1121 * Store an attestation reference. If the reference is already present,
1122 * it is replaced with the new reference.
1123 *
1124 * @param h handle to the re:claimID service
1125 * @param pkey private key of the identity
1126 * @param attr the reference value
1127 * @param exp_interval the relative expiration interval for the reference
1128 * @param cont continuation to call when done
1129 * @param cont_cls closure for @a cont
1130 * @return handle to abort the request
1131 */
1132struct GNUNET_RECLAIM_Operation *
1133GNUNET_RECLAIM_attestation_reference_store (
1134 struct GNUNET_RECLAIM_Handle *h,
1135 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1136 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
1137 const struct GNUNET_TIME_Relative *exp_interval,
1138 GNUNET_RECLAIM_ContinuationWithStatus cont,
1139 void *cont_cls)
1140{
1141 struct GNUNET_RECLAIM_Operation *op;
1142 struct AttributeStoreMessage *sam;
1143 size_t attr_len;
1144 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
1145 op->h = h;
1146 op->as_cb = cont;
1147 op->cls = cont_cls;
1148 op->r_id = h->r_id_gen++;
1149 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1150 attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (attr);
1151 op->env = GNUNET_MQ_msg_extra (sam,
1152 attr_len,
1153 GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE);
1154 sam->identity = *pkey;
1155 sam->id = htonl (op->r_id);
1156 sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
1157
1158 GNUNET_RECLAIM_ATTESTATION_REF_serialize (attr, (char *) &sam[1]);
1159
1160 sam->attr_len = htons (attr_len);
1161 if (NULL != h->mq)
1162 GNUNET_MQ_send_copy (h->mq, op->env);
1163 return op;
1164}
1165
1166
1167/**
1121 * List all attributes for a local identity. 1168 * List all attributes for a local identity.
1122 * This MUST lock the `struct GNUNET_RECLAIM_Handle` 1169 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
1123 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and 1170 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and