aboutsummaryrefslogtreecommitdiff
path: root/src/include
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/include
parentc136a16600cd4f72d7def1af7b4aa7592310c898 (diff)
downloadgnunet-bb286cb253251e8210ed686dbde3dc8ecee16420.tar.gz
gnunet-bb286cb253251e8210ed686dbde3dc8ecee16420.zip
Preparation for Reference Type
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_gnsrecord_lib.h5
-rw-r--r--src/include/gnunet_protocols.h2
-rw-r--r--src/include/gnunet_reclaim_attribute_lib.h73
-rw-r--r--src/include/gnunet_reclaim_service.h22
4 files changed, 101 insertions, 1 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 41e23e1ab..9e430c2aa 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -146,6 +146,11 @@ extern "C" {
146#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR 65554 146#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR 65554
147 147
148/** 148/**
149 * Record type for reclaim attestation references
150 */
151#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_REF 65555
152
153/**
149 * Flags that can be set for a record. 154 * Flags that can be set for a record.
150 */ 155 */
151enum GNUNET_GNSRECORD_Flags 156enum GNUNET_GNSRECORD_Flags
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index f1dc74462..f8d424359 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2720,6 +2720,8 @@ extern "C" {
2720 2720
2721#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 2721#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979
2722 2722
2723#define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE 980
2724
2723/************************************************** 2725/**************************************************
2724 * 2726 *
2725 * ABD MESSAGE TYPES 2727 * ABD MESSAGE TYPES
diff --git a/src/include/gnunet_reclaim_attribute_lib.h b/src/include/gnunet_reclaim_attribute_lib.h
index 8476e77fc..cfdecae79 100644
--- a/src/include/gnunet_reclaim_attribute_lib.h
+++ b/src/include/gnunet_reclaim_attribute_lib.h
@@ -138,6 +138,34 @@ struct GNUNET_RECLAIM_ATTESTATION_Claim
138}; 138};
139 139
140/** 140/**
141 * A reference to an Attestatiom.
142 */
143struct GNUNET_RECLAIM_ATTESTATION_REFERENCE
144{
145 /**
146 * ID
147 */
148 uint64_t id;
149
150 /**
151 * Referenced ID of Attestation
152 */
153 uint64_t id_attest;
154
155 /**
156 * The name of the attribute/attestation reference value. Note "name" must never be individually
157 * free'd
158 */
159 const char *name;
160
161 /**
162 * The name of the attribute/attestation reference value. Note "name" must never be individually
163 * free'd
164 */
165 const char *reference_value;
166};
167
168/**
141 * A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures. 169 * A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures.
142 */ 170 */
143struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList 171struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList
@@ -450,6 +478,51 @@ GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t type);
450uint32_t 478uint32_t
451GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename); 479GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename);
452 480
481/**
482 * Create a new attestation reference.
483 *
484 * @param attr_name the referenced claim name
485 * @param ref_value the claim name in the attestation
486 * @return the new reference
487 */
488struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
489GNUNET_RECLAIM_ATTESTATION_reference_new (const char *attr_name,
490 const char *ref_value);
491
492
493/**
494 * Get required size for serialization buffer
495 *
496 * @param attr the reference to serialize
497 * @return the required buffer size
498 */
499size_t
500GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (
501 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr);
502
503/**
504 * Serialize a reference
505 *
506 * @param attr the reference to serialize
507 * @param result the serialized reference
508 * @return length of serialized data
509 */
510size_t
511GNUNET_RECLAIM_ATTESTATION_REF_serialize (
512 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
513 char *result);
514
515/**
516 * Deserialize a reference
517 *
518 * @param data the serialized reference
519 * @param data_size the length of the serialized data
520 *
521 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
522 */
523struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *
524GNUNET_RECLAIM_ATTESTATION_REF_deserialize (const char *data, size_t data_size);
525
453#if 0 /* keep Emacsens' auto-indent happy */ 526#if 0 /* keep Emacsens' auto-indent happy */
454{ 527{
455#endif 528#endif
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h
index e7384fd06..eb6c1bc9e 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -117,7 +117,7 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
117 */ 117 */
118typedef void (*GNUNET_RECLAIM_AttributeResult) ( 118typedef void (*GNUNET_RECLAIM_AttributeResult) (
119 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 119 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
120 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 120 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
121 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest); 121 const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest);
122 122
123 123
@@ -242,6 +242,26 @@ GNUNET_RECLAIM_get_attributes_start (
242 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, 242 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
243 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); 243 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
244 244
245/**
246 * Store an attestation reference. If the reference is already present,
247 * it is replaced with the new reference.
248 *
249 * @param h handle to the re:claimID service
250 * @param pkey private key of the identity
251 * @param attr the reference value
252 * @param exp_interval the relative expiration interval for the reference
253 * @param cont continuation to call when done
254 * @param cont_cls closure for @a cont
255 * @return handle to abort the request
256 */
257struct GNUNET_RECLAIM_Operation *
258GNUNET_RECLAIM_attestation_reference_store (
259 struct GNUNET_RECLAIM_Handle *h,
260 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
261 const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
262 const struct GNUNET_TIME_Relative *exp_interval,
263 GNUNET_RECLAIM_ContinuationWithStatus cont,
264 void *cont_cls);
245 265
246/** 266/**
247 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start 267 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start