aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am1
-rw-r--r--src/include/gnunet_block_lib.h13
-rw-r--r--src/include/gnunet_common.h6
-rw-r--r--src/include/gnunet_crypto_lib.h12
-rw-r--r--src/include/gnunet_curl_lib.h22
-rw-r--r--src/include/gnunet_gnsrecord_lib.h7
-rw-r--r--src/include/gnunet_my_lib.h2
-rw-r--r--src/include/gnunet_mysql_lib.h6
-rw-r--r--src/include/gnunet_protocols.h215
-rw-r--r--src/include/gnunet_reclaim_lib.h412
-rw-r--r--src/include/gnunet_reclaim_plugin.h197
-rw-r--r--src/include/gnunet_reclaim_service.h79
-rw-r--r--src/include/gnunet_seti_service.h369
-rw-r--r--src/include/gnunet_setu_service.h390
-rw-r--r--src/include/gnunet_uri_lib.h122
15 files changed, 1688 insertions, 165 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index d2c254ae6..e542038d3 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -119,5 +119,6 @@ gnunetinclude_HEADERS = \
119 gnunet_transport_monitor_service.h \ 119 gnunet_transport_monitor_service.h \
120 gnunet_transport_plugin.h \ 120 gnunet_transport_plugin.h \
121 gnunet_tun_lib.h \ 121 gnunet_tun_lib.h \
122 gnunet_uri_lib.h \
122 gnunet_util_lib.h \ 123 gnunet_util_lib.h \
123 gnunet_vpn_service.h 124 gnunet_vpn_service.h
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 18ca6f63f..73b51252e 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -137,6 +137,19 @@ enum GNUNET_BLOCK_Type
137 * Contains either special marker elements or a nested block. 137 * Contains either special marker elements or a nested block.
138 */ 138 */
139 GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT = 25, 139 GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT = 25,
140
141 /**
142 * Block for testing set intersection. If first byte of the block
143 * is non-zero, the block is considered invalid.
144 */
145 GNUNET_BLOCK_TYPE_SETI_TEST = 24,
146
147 /**
148 * Block for testing set union. If first byte of the block
149 * is non-zero, the block is considered invalid.
150 */
151 GNUNET_BLOCK_TYPE_SETU_TEST = 24,
152
140}; 153};
141 154
142 155
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index b2f99cd55..fcaae1026 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -1173,9 +1173,9 @@ GNUNET_memcmp_ct_ (const void *b1,
1173 * @param a pointer to @a n bytes which should be tested for the 1173 * @param a pointer to @a n bytes which should be tested for the
1174 * entire memory being zero'ed out. 1174 * entire memory being zero'ed out.
1175 * @param n number of bytes in @a to be tested 1175 * @param n number of bytes in @a to be tested
1176 * @return 0 if a is zero, non-zero otherwise 1176 * @return GNUNET_YES if a is zero, GNUNET_NO otherwise
1177 */ 1177 */
1178int 1178enum GNUNET_GenericReturnValue
1179GNUNET_is_zero_ (const void *a, 1179GNUNET_is_zero_ (const void *a,
1180 size_t n); 1180 size_t n);
1181 1181
@@ -1185,7 +1185,7 @@ GNUNET_is_zero_ (const void *a,
1185 * 1185 *
1186 * @param a pointer to a struct which should be tested for the 1186 * @param a pointer to a struct which should be tested for the
1187 * entire memory being zero'ed out. 1187 * entire memory being zero'ed out.
1188 * @return 0 if a is zero, non-zero otherwise 1188 * @return GNUNET_YES if a is zero, GNUNET_NO otherwise
1189 */ 1189 */
1190#define GNUNET_is_zero(a) \ 1190#define GNUNET_is_zero(a) \
1191 GNUNET_is_zero_ (a, sizeof (*a)) 1191 GNUNET_is_zero_ (a, sizeof (*a))
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index f8eef5406..8c3f4f058 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -50,6 +50,7 @@ extern "C" {
50#endif 50#endif
51#endif 51#endif
52 52
53#include <sodium.h>
53 54
54/** 55/**
55 * The identity of the host (wraps the signing key of the peer). 56 * The identity of the host (wraps the signing key of the peer).
@@ -668,6 +669,15 @@ GNUNET_CRYPTO_hash (const void *block,
668 669
669 670
670/** 671/**
672 * Value for a salt for #GNUNET_CRYPTO_pow_hash().
673 */
674struct GNUNET_CRYPTO_PowSalt
675{
676 char salt[crypto_pwhash_argon2id_SALTBYTES];
677};
678
679
680/**
671 * Calculate the 'proof-of-work' hash (an expensive hash). 681 * Calculate the 'proof-of-work' hash (an expensive hash).
672 * 682 *
673 * @param salt salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long. 683 * @param salt salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long.
@@ -676,7 +686,7 @@ GNUNET_CRYPTO_hash (const void *block,
676 * @param result where to write the resulting hash 686 * @param result where to write the resulting hash
677 */ 687 */
678void 688void
679GNUNET_CRYPTO_pow_hash (const char *salt, 689GNUNET_CRYPTO_pow_hash (const struct GNUNET_CRYPTO_PowSalt *salt,
680 const void *buf, 690 const void *buf,
681 size_t buf_len, 691 size_t buf_len,
682 struct GNUNET_HashCode *result); 692 struct GNUNET_HashCode *result);
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index 9de58d608..f291d6b14 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -275,9 +275,8 @@ GNUNET_CURL_set_userpass (struct GNUNET_CURL_Context *ctx,
275 275
276 276
277/** 277/**
278 * Force use of the provided TLS client certificate 278 * Force use of the provided TLS client certificate for client authentication
279 * for client authentication for all operations performed 279 * for all operations performed with @a ctx.
280 * with @a ctx.
281 * 280 *
282 * Note that if the provided information is incorrect, 281 * Note that if the provided information is incorrect,
283 * the earliest operation that could fail is 282 * the earliest operation that could fail is
@@ -298,9 +297,9 @@ GNUNET_CURL_set_tlscert (struct GNUNET_CURL_Context *ctx,
298 297
299 298
300/** 299/**
301 * Schedule a CURL request to be executed and call the given @a jcc 300 * Schedule a CURL request to be executed and call the given @a jcc upon its
302 * upon its completion. Note that the context will make use of the 301 * completion. Note that the context will make use of the CURLOPT_PRIVATE
303 * CURLOPT_PRIVATE facility of the CURL @a eh. 302 * facility of the CURL @a eh.
304 * 303 *
305 * This function modifies the CURL handle to add the 304 * This function modifies the CURL handle to add the
306 * "Content-Type: application/json" header if @a add_json is set. 305 * "Content-Type: application/json" header if @a add_json is set.
@@ -345,6 +344,17 @@ GNUNET_CURL_job_add_raw (struct GNUNET_CURL_Context *ctx,
345 344
346 345
347/** 346/**
347 * Add @a extra_headers to the HTTP headers for @a job.
348 *
349 * @param[in,out] job the job to modify
350 * @param extra_headers headers to append
351 */
352void
353GNUNET_CURL_extend_headers (struct GNUNET_CURL_Job *job,
354 const struct curl_slist *extra_headers);
355
356
357/**
348 * Cancel a job. Must only be called before the job completion 358 * Cancel a job. Must only be called before the job completion
349 * callback is called for the respective job. 359 * callback is called for the respective job.
350 * 360 *
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index c976c89c5..960203fb1 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -143,12 +143,13 @@ extern "C" {
143/** 143/**
144 * Record type for an attribute attestation 144 * Record type for an attribute attestation
145 */ 145 */
146#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION 65554 146#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL 65554
147 147
148/** 148/**
149 * Record type for an attestation reference in a ticket 149 * Record type for a presentation of a credential (used
150 * in a ticket record set)
150 */ 151 */
151#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF 65555 152#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555
152 153
153 154
154/** 155/**
diff --git a/src/include/gnunet_my_lib.h b/src/include/gnunet_my_lib.h
index 74e7bf492..b8513ca84 100644
--- a/src/include/gnunet_my_lib.h
+++ b/src/include/gnunet_my_lib.h
@@ -245,7 +245,7 @@ struct GNUNET_MY_ResultSpec
245 /** 245 /**
246 * Memory for MySQL to notify us about NULL values. 246 * Memory for MySQL to notify us about NULL values.
247 */ 247 */
248 my_bool is_null; 248 MYSQL_BOOL is_null;
249}; 249};
250 250
251 251
diff --git a/src/include/gnunet_mysql_lib.h b/src/include/gnunet_mysql_lib.h
index 964483024..843d3ccb3 100644
--- a/src/include/gnunet_mysql_lib.h
+++ b/src/include/gnunet_mysql_lib.h
@@ -41,6 +41,12 @@ extern "C"
41#endif 41#endif
42#endif 42#endif
43 43
44#ifdef HAVE_MYSQL8
45 typedef bool MYSQL_BOOL;
46#else
47 typedef my_bool MYSQL_BOOL; //MySQL < 8 wants this
48#endif
49
44 50
45/** 51/**
46 * Mysql context. 52 * Mysql context.
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 5af58664f..d9821ffe8 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1659,9 +1659,212 @@ extern "C" {
1659 1659
1660 1660
1661/******************************************************************************* 1661/*******************************************************************************
1662 * SETU message types
1663 ******************************************************************************/
1664
1665
1666/**
1667 * Cancel a set operation
1668 */
1669#define GNUNET_MESSAGE_TYPE_SETU_CANCEL 550
1670
1671/**
1672 * Add element to set
1673 */
1674#define GNUNET_MESSAGE_TYPE_SETU_ADD 551
1675
1676/**
1677 * Create a new local set
1678 */
1679#define GNUNET_MESSAGE_TYPE_SETU_CREATE 552
1680
1681/**
1682 * Handle result message from operation
1683 */
1684#define GNUNET_MESSAGE_TYPE_SETU_RESULT 553
1685
1686/**
1687 * Evaluate a set operation
1688 */
1689#define GNUNET_MESSAGE_TYPE_SETU_EVALUATE 554
1690
1691/**
1692 * Listen for operation requests
1693 */
1694#define GNUNET_MESSAGE_TYPE_SETU_LISTEN 555
1695
1696/**
1697 * Reject a set request.
1698 */
1699#define GNUNET_MESSAGE_TYPE_SETU_REJECT 556
1700
1701/**
1702 * Accept an incoming set request
1703 */
1704#define GNUNET_MESSAGE_TYPE_SETU_ACCEPT 557
1705
1706/**
1707 * Notify the client of an incoming request from a remote peer
1708 */
1709#define GNUNET_MESSAGE_TYPE_SETU_REQUEST 558
1710
1711
1712/**
1713 * Demand the whole element from the other
1714 * peer, given only the hash code.
1715 */
1716#define GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL 559
1717
1718/**
1719 * Demand the whole element from the other
1720 * peer, given only the hash code.
1721 */
1722#define GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND 560
1723
1724/**
1725 * Tell the other peer to send us a list of
1726 * hashes that match an IBF key.
1727 */
1728#define GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY 561
1729
1730/**
1731 * Tell the other peer which hashes match a
1732 * given IBF key.
1733 */
1734#define GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER 562
1735
1736/**
1737 * Request a set union operation from a remote peer.
1738 */
1739#define GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST 563
1740
1741/**
1742 * Strata estimator.
1743 */
1744#define GNUNET_MESSAGE_TYPE_SETU_P2P_SE 564
1745
1746/**
1747 * Invertible bloom filter.
1748 */
1749#define GNUNET_MESSAGE_TYPE_SETU_P2P_IBF 565
1750
1751/**
1752 * Actual set elements.
1753 */
1754#define GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS 566
1755
1756/**
1757 * Requests for the elements with the given hashes.
1758 */
1759#define GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENT_REQUESTS 567
1760
1761/**
1762 * Set operation is done.
1763 */
1764#define GNUNET_MESSAGE_TYPE_SETU_P2P_DONE 568
1765
1766/**
1767 * Compressed strata estimator.
1768 */
1769#define GNUNET_MESSAGE_TYPE_SETU_P2P_SEC 569
1770
1771/**
1772 * Request all missing elements from the other peer,
1773 * based on their sets and the elements we previously sent
1774 * with #GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS.
1775 */
1776#define GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE 570
1777
1778/**
1779 * Send a set element, not as response to a demand but because
1780 * we're sending the full set.
1781 */
1782#define GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT 571
1783
1784/**
1785 * Request all missing elements from the other peer,
1786 * based on their sets and the elements we previously sent
1787 * with #GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS.
1788 */
1789#define GNUNET_MESSAGE_TYPE_SETU_P2P_OVER 572
1790
1791
1792/*******************************************************************************
1793 * SETI message types
1794 ******************************************************************************/
1795
1796
1797/**
1798 * Cancel a set operation
1799 */
1800#define GNUNET_MESSAGE_TYPE_SETI_CANCEL 580
1801
1802/**
1803 * Add element to set.
1804 */
1805#define GNUNET_MESSAGE_TYPE_SETI_ADD 581
1806
1807/**
1808 * Create a new local set
1809 */
1810#define GNUNET_MESSAGE_TYPE_SETI_CREATE 582
1811
1812/**
1813 * Handle result message from operation
1814 */
1815#define GNUNET_MESSAGE_TYPE_SETI_RESULT 583
1816
1817/**
1818 * Evaluate a set operation
1819 */
1820#define GNUNET_MESSAGE_TYPE_SETI_EVALUATE 584
1821
1822/**
1823 * Listen for operation requests
1824 */
1825#define GNUNET_MESSAGE_TYPE_SETI_LISTEN 585
1826
1827/**
1828 * Reject a set request.
1829 */
1830#define GNUNET_MESSAGE_TYPE_SETI_REJECT 586
1831
1832/**
1833 * Accept an incoming set request
1834 */
1835#define GNUNET_MESSAGE_TYPE_SETI_ACCEPT 587
1836
1837/**
1838 * Notify the client of an incoming request from a remote peer
1839 */
1840#define GNUNET_MESSAGE_TYPE_SETI_REQUEST 588
1841
1842/**
1843 * Information about the element count for intersection
1844 */
1845#define GNUNET_MESSAGE_TYPE_SETI_P2P_ELEMENT_INFO 591
1846
1847/**
1848 * Bloom filter message for intersection exchange started by Bob.
1849 */
1850#define GNUNET_MESSAGE_TYPE_SETI_P2P_BF 592
1851
1852/**
1853 * Intersection operation is done.
1854 */
1855#define GNUNET_MESSAGE_TYPE_SETI_P2P_DONE 593
1856
1857/**
1858 * Request to begin set intersection operation.
1859 */
1860#define GNUNET_MESSAGE_TYPE_SETI_P2P_OPERATION_REQUEST 594
1861
1862
1863/*******************************************************************************
1662 * SET message types 1864 * SET message types
1663 ******************************************************************************/ 1865 ******************************************************************************/
1664 1866
1867
1665/** 1868/**
1666 * Demand the whole element from the other 1869 * Demand the whole element from the other
1667 * peer, given only the hash code. 1870 * peer, given only the hash code.
@@ -2697,17 +2900,17 @@ extern "C" {
2697 2900
2698#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 2901#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976
2699 2902
2700#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE 977 2903#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE 977
2701 2904
2702#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE 978 2905#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE 978
2703 2906
2704#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 2907#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT 979
2705 2908
2706#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 980 2909#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START 980
2707 2910
2708#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 981 2911#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP 981
2709 2912
2710#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 982 2913#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT 982
2711 2914
2712 2915
2713/************************************************** 2916/**************************************************
diff --git a/src/include/gnunet_reclaim_lib.h b/src/include/gnunet_reclaim_lib.h
index 4f2d6dba5..bbf1c3ad3 100644
--- a/src/include/gnunet_reclaim_lib.h
+++ b/src/include/gnunet_reclaim_lib.h
@@ -39,32 +39,41 @@ extern "C" {
39 39
40#include "gnunet_util_lib.h" 40#include "gnunet_util_lib.h"
41 41
42enum GNUNET_RECLAIM_AttributeType {
43 /**
44 * No value attribute.
45 */
46 GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE = 0,
42 47
43/** 48 /**
44 * No value attribute. 49 * String attribute.
45 */ 50 */
46#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE 0 51 GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING = 1
52};
47 53
48/** 54enum GNUNET_RECLAIM_CredentialType {
49 * String attribute. 55 /**
50 */ 56 * No value credential.
51#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1 57 */
58 GNUNET_RECLAIM_CREDENTIAL_TYPE_NONE = 0,
52 59
53/** 60 /**
54* No value attestation. 61 * A JSON Web Token credential.
55*/ 62 */
56#define GNUNET_RECLAIM_ATTESTATION_TYPE_NONE 10 63 GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT = 1,
57 64
58/** 65 /**
59* A JSON Web Token attestation. 66 * libpabc credential
60*/ 67 */
61#define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11 68 GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC = 2
69};
62 70
63/** 71/**
64 * We want an ID to be a 256-bit symmetric key 72 * We want an ID to be a 256-bit symmetric key
65 */ 73 */
66#define GNUNET_RECLAIM_ID_LENGTH (256 / 8) 74#define GNUNET_RECLAIM_ID_LENGTH (256 / 8)
67 75
76GNUNET_NETWORK_STRUCT_BEGIN
68/** 77/**
69 * A reclaim identifier 78 * A reclaim identifier
70 * FIXME maybe put this in a different namespace 79 * FIXME maybe put this in a different namespace
@@ -74,6 +83,8 @@ struct GNUNET_RECLAIM_Identifier
74 char id[GNUNET_RECLAIM_ID_LENGTH]; 83 char id[GNUNET_RECLAIM_ID_LENGTH];
75}; 84};
76 85
86GNUNET_NETWORK_STRUCT_END
87
77static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO; 88static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO;
78 89
79#define GNUNET_RECLAIM_id_is_equal(a,b) ((0 == \ 90#define GNUNET_RECLAIM_id_is_equal(a,b) ((0 == \
@@ -104,9 +115,10 @@ struct GNUNET_RECLAIM_Attribute
104 struct GNUNET_RECLAIM_Identifier id; 115 struct GNUNET_RECLAIM_Identifier id;
105 116
106 /** 117 /**
107 * Referenced ID of Attestation (may be 0 if self-attested) 118 * Referenced ID of credential
119 * (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
108 */ 120 */
109 struct GNUNET_RECLAIM_Identifier attestation; 121 struct GNUNET_RECLAIM_Identifier credential;
110 122
111 /** 123 /**
112 * Type of Claim 124 * Type of Claim
@@ -138,9 +150,9 @@ struct GNUNET_RECLAIM_Attribute
138}; 150};
139 151
140/** 152/**
141 * An attestation. 153 * A credential.
142 */ 154 */
143struct GNUNET_RECLAIM_Attestation 155struct GNUNET_RECLAIM_Credential
144{ 156{
145 /** 157 /**
146 * ID 158 * ID
@@ -158,7 +170,7 @@ struct GNUNET_RECLAIM_Attestation
158 uint32_t flag; 170 uint32_t flag;
159 171
160 /** 172 /**
161 * The name of the attribute. Note "name" must never be individually 173 * The name of the credential. Note: must never be individually
162 * free'd 174 * free'd
163 */ 175 */
164 const char *name; 176 const char *name;
@@ -169,7 +181,36 @@ struct GNUNET_RECLAIM_Attestation
169 size_t data_size; 181 size_t data_size;
170 182
171 /** 183 /**
172 * Binary value stored as attribute value. Note: "data" must never 184 * Binary value stored as credential value. Note: "data" must never
185 * be individually 'malloc'ed, but instead always points into some
186 * existing data area.
187 */
188 const void *data;
189};
190
191
192/**
193 * A credential presentation.
194 */
195struct GNUNET_RECLAIM_Presentation
196{
197 /**
198 * The credential id of which this is a presentation.
199 */
200 struct GNUNET_RECLAIM_Identifier credential_id;
201
202 /**
203 * Type/Format of Claim
204 */
205 uint32_t type;
206
207 /**
208 * Number of bytes in @e data.
209 */
210 size_t data_size;
211
212 /**
213 * Binary value stored as presentation value. Note: "data" must never
173 * be individually 'malloc'ed, but instead always points into some 214 * be individually 'malloc'ed, but instead always points into some
174 * existing data area. 215 * existing data area.
175 */ 216 */
@@ -177,6 +218,7 @@ struct GNUNET_RECLAIM_Attestation
177}; 218};
178 219
179 220
221
180/** 222/**
181 * A list of GNUNET_RECLAIM_Attribute structures. 223 * A list of GNUNET_RECLAIM_Attribute structures.
182 */ 224 */
@@ -214,56 +256,94 @@ struct GNUNET_RECLAIM_AttributeListEntry
214}; 256};
215 257
216/** 258/**
217 * A list of GNUNET_RECLAIM_Attestation structures. 259 * A list of GNUNET_RECLAIM_Credential structures.
260 */
261struct GNUNET_RECLAIM_CredentialList
262{
263 /**
264 * List head
265 */
266 struct GNUNET_RECLAIM_CredentialListEntry *list_head;
267
268 /**
269 * List tail
270 */
271 struct GNUNET_RECLAIM_CredentialListEntry *list_tail;
272};
273
274
275struct GNUNET_RECLAIM_CredentialListEntry
276{
277 /**
278 * DLL
279 */
280 struct GNUNET_RECLAIM_CredentialListEntry *prev;
281
282 /**
283 * DLL
284 */
285 struct GNUNET_RECLAIM_CredentialListEntry *next;
286
287 /**
288 * The credential
289 */
290 struct GNUNET_RECLAIM_Credential *credential;
291
292};
293
294
295/**
296 * A list of GNUNET_RECLAIM_Presentation structures.
218 */ 297 */
219struct GNUNET_RECLAIM_AttestationList 298struct GNUNET_RECLAIM_PresentationList
220{ 299{
221 /** 300 /**
222 * List head 301 * List head
223 */ 302 */
224 struct GNUNET_RECLAIM_AttestationListEntry *list_head; 303 struct GNUNET_RECLAIM_PresentationListEntry *list_head;
225 304
226 /** 305 /**
227 * List tail 306 * List tail
228 */ 307 */
229 struct GNUNET_RECLAIM_AttestationListEntry *list_tail; 308 struct GNUNET_RECLAIM_PresentationListEntry *list_tail;
230}; 309};
231 310
232 311
233struct GNUNET_RECLAIM_AttestationListEntry 312struct GNUNET_RECLAIM_PresentationListEntry
234{ 313{
235 /** 314 /**
236 * DLL 315 * DLL
237 */ 316 */
238 struct GNUNET_RECLAIM_AttestationListEntry *prev; 317 struct GNUNET_RECLAIM_PresentationListEntry *prev;
239 318
240 /** 319 /**
241 * DLL 320 * DLL
242 */ 321 */
243 struct GNUNET_RECLAIM_AttestationListEntry *next; 322 struct GNUNET_RECLAIM_PresentationListEntry *next;
244 323
245 /** 324 /**
246 * The attestation 325 * The credential
247 */ 326 */
248 struct GNUNET_RECLAIM_Attestation *attestation; 327 struct GNUNET_RECLAIM_Presentation *presentation;
249 328
250}; 329};
251 330
252 331
332
253/** 333/**
254 * Create a new attribute claim. 334 * Create a new attribute claim.
255 * 335 *
256 * @param attr_name the attribute name 336 * @param attr_name the attribute name
257 * @param attestation ID of the attestation (may be NULL) 337 * @param credential ID of the credential (may be NULL)
258 * @param type the attribute type 338 * @param type the attribute type
259 * @param data the attribute value. Must be the mapped name if attestation not NULL 339 * @param data the attribute value. Must be #attr_name if credential not NULL
260 * @param data_size the attribute value size 340 * @param data_size the attribute value size
261 * @return the new attribute 341 * @return the new attribute
262 */ 342 */
263struct GNUNET_RECLAIM_Attribute * 343struct GNUNET_RECLAIM_Attribute *
264GNUNET_RECLAIM_attribute_new (const char *attr_name, 344GNUNET_RECLAIM_attribute_new (const char *attr_name,
265 const struct 345 const struct
266 GNUNET_RECLAIM_Identifier *attestation, 346 GNUNET_RECLAIM_Identifier *credential,
267 uint32_t type, 347 uint32_t type,
268 const void *data, 348 const void *data,
269 size_t data_size); 349 size_t data_size);
@@ -295,7 +375,7 @@ GNUNET_RECLAIM_attribute_list_destroy (
295 * 375 *
296 * @param attrs the attribute list to add to 376 * @param attrs the attribute list to add to
297 * @param attr_name the name of the new attribute claim 377 * @param attr_name the name of the new attribute claim
298 * @param attestation attestation ID (may be NULL) 378 * @param credential credential ID (may be NULL)
299 * @param type the type of the claim 379 * @param type the type of the claim
300 * @param data claim payload 380 * @param data claim payload
301 * @param data_size claim payload size 381 * @param data_size claim payload size
@@ -304,7 +384,7 @@ void
304GNUNET_RECLAIM_attribute_list_add ( 384GNUNET_RECLAIM_attribute_list_add (
305 struct GNUNET_RECLAIM_AttributeList *attrs, 385 struct GNUNET_RECLAIM_AttributeList *attrs,
306 const char *attr_name, 386 const char *attr_name,
307 const struct GNUNET_RECLAIM_Identifier *attestation, 387 const struct GNUNET_RECLAIM_Identifier *credential,
308 uint32_t type, 388 uint32_t type,
309 const void *data, 389 const void *data,
310 size_t data_size); 390 size_t data_size);
@@ -361,11 +441,13 @@ GNUNET_RECLAIM_attribute_serialize (const struct GNUNET_RECLAIM_Attribute *attr,
361 * 441 *
362 * @param data the serialized attribute 442 * @param data the serialized attribute
363 * @param data_size the length of the serialized data 443 * @param data_size the length of the serialized data
444 * @param attr deserialized attribute. Will be allocated. Must be free'd
364 * 445 *
365 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller 446 * @return number of bytes read or -1 for error
366 */ 447 */
367struct GNUNET_RECLAIM_Attribute * 448ssize_t
368GNUNET_RECLAIM_attribute_deserialize (const char *data, size_t data_size); 449GNUNET_RECLAIM_attribute_deserialize (const char *data, size_t data_size,
450 struct GNUNET_RECLAIM_Attribute **attr);
369 451
370 452
371/** 453/**
@@ -434,8 +516,8 @@ GNUNET_RECLAIM_attribute_number_to_typename (uint32_t type);
434 * @return the required buffer size 516 * @return the required buffer size
435 */ 517 */
436size_t 518size_t
437GNUNET_RECLAIM_attestation_list_serialize_get_size ( 519GNUNET_RECLAIM_credential_list_serialize_get_size (
438 const struct GNUNET_RECLAIM_AttestationList *attestations); 520 const struct GNUNET_RECLAIM_CredentialList *credentials);
439 521
440 522
441/** 523/**
@@ -444,8 +526,8 @@ GNUNET_RECLAIM_attestation_list_serialize_get_size (
444 * @param attrs list to destroy 526 * @param attrs list to destroy
445 */ 527 */
446void 528void
447GNUNET_RECLAIM_attestation_list_destroy ( 529GNUNET_RECLAIM_credential_list_destroy (
448 struct GNUNET_RECLAIM_AttestationList *attestations); 530 struct GNUNET_RECLAIM_CredentialList *credentials);
449 531
450 532
451/** 533/**
@@ -457,8 +539,8 @@ GNUNET_RECLAIM_attestation_list_destroy (
457 * @param data_size claim payload size 539 * @param data_size claim payload size
458 */ 540 */
459void 541void
460GNUNET_RECLAIM_attestation_list_add ( 542GNUNET_RECLAIM_credential_list_add (
461 struct GNUNET_RECLAIM_AttestationList *attrs, 543 struct GNUNET_RECLAIM_CredentialList *attrs,
462 const char *att_name, 544 const char *att_name,
463 uint32_t type, 545 uint32_t type,
464 const void *data, 546 const void *data,
@@ -473,8 +555,8 @@ GNUNET_RECLAIM_attestation_list_add (
473 * @return length of serialized data 555 * @return length of serialized data
474 */ 556 */
475size_t 557size_t
476GNUNET_RECLAIM_attestation_list_serialize ( 558GNUNET_RECLAIM_credential_list_serialize (
477 const struct GNUNET_RECLAIM_AttestationList *attrs, 559 const struct GNUNET_RECLAIM_CredentialList *attrs,
478 char *result); 560 char *result);
479 561
480 562
@@ -485,75 +567,75 @@ GNUNET_RECLAIM_attestation_list_serialize (
485 * @param data_size the length of the serialized data 567 * @param data_size the length of the serialized data
486 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller 568 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
487 */ 569 */
488struct GNUNET_RECLAIM_AttestationList * 570struct GNUNET_RECLAIM_CredentialList *
489GNUNET_RECLAIM_attestation_list_deserialize (const char *data, 571GNUNET_RECLAIM_credential_list_deserialize (const char *data,
490 size_t data_size); 572 size_t data_size);
491 573
492 574
493/** 575/**
494 * @param attestation the attestation to serialize 576 * @param credential the credential to serialize
495 * @return the required buffer size 577 * @return the required buffer size
496 */ 578 */
497size_t 579size_t
498GNUNET_RECLAIM_attestation_serialize_get_size ( 580GNUNET_RECLAIM_credential_serialize_get_size (
499 const struct GNUNET_RECLAIM_Attestation *attestation); 581 const struct GNUNET_RECLAIM_Credential *credential);
500 582
501 583
502/** 584/**
503 * Serialize an attestation 585 * Serialize an credential
504 * 586 *
505 * @param attestation the attestation to serialize 587 * @param credential the credential to serialize
506 * @param result the serialized attestation 588 * @param result the serialized credential
507 * @return length of serialized data 589 * @return length of serialized data
508 */ 590 */
509size_t 591size_t
510GNUNET_RECLAIM_attestation_serialize ( 592GNUNET_RECLAIM_credential_serialize (
511 const struct GNUNET_RECLAIM_Attestation *attestation, 593 const struct GNUNET_RECLAIM_Credential *credential,
512 char *result); 594 char *result);
513 595
514 596
515/** 597/**
516 * Deserialize an attestation 598 * Deserialize an credential
517 * 599 *
518 * @param data the serialized attestation 600 * @param data the serialized credential
519 * @param data_size the length of the serialized data 601 * @param data_size the length of the serialized data
520 * 602 *
521 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller 603 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
522 */ 604 */
523struct GNUNET_RECLAIM_Attestation * 605struct GNUNET_RECLAIM_Credential *
524GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size); 606GNUNET_RECLAIM_credential_deserialize (const char *data, size_t data_size);
525 607
526 608
527/** 609/**
528 * Create a new attestation. 610 * Create a new credential.
529 * 611 *
530 * @param name the attestation name 612 * @param name the credential name
531 * @param type the attestation type 613 * @param type the credential type
532 * @param data the attestation value 614 * @param data the credential value
533 * @param data_size the attestation value size 615 * @param data_size the credential value size
534 * @return the new attestation 616 * @return the new credential
535 */ 617 */
536struct GNUNET_RECLAIM_Attestation * 618struct GNUNET_RECLAIM_Credential *
537GNUNET_RECLAIM_attestation_new (const char *name, 619GNUNET_RECLAIM_credential_new (const char *name,
538 uint32_t type, 620 uint32_t type,
539 const void *data, 621 const void *data,
540 size_t data_size); 622 size_t data_size);
541 623
542/** 624/**
543 * Convert the 'claim' of an attestation to a string 625 * Convert the 'claim' of an credential to a string
544 * 626 *
545 * @param type the type of attestation 627 * @param type the type of credential
546 * @param data claim in binary encoding 628 * @param data claim in binary encoding
547 * @param data_size number of bytes in @a data 629 * @param data_size number of bytes in @a data
548 * @return NULL on error, otherwise human-readable representation of the claim 630 * @return NULL on error, otherwise human-readable representation of the claim
549 */ 631 */
550char * 632char *
551GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, 633GNUNET_RECLAIM_credential_value_to_string (uint32_t type,
552 const void *data, 634 const void *data,
553 size_t data_size); 635 size_t data_size);
554 636
555/** 637/**
556 * Convert human-readable version of a 'claim' of an attestation to the binary 638 * Convert human-readable version of a 'claim' of an credential to the binary
557 * representation 639 * representation
558 * 640 *
559 * @param type type of the claim 641 * @param type type of the claim
@@ -563,48 +645,206 @@ GNUNET_RECLAIM_attestation_value_to_string (uint32_t type,
563 * @return #GNUNET_OK on success 645 * @return #GNUNET_OK on success
564 */ 646 */
565int 647int
566GNUNET_RECLAIM_attestation_string_to_value (uint32_t type, 648GNUNET_RECLAIM_credential_string_to_value (uint32_t type,
567 const char *s, 649 const char *s,
568 void **data, 650 void **data,
569 size_t *data_size); 651 size_t *data_size);
570 652
571/** 653/**
572 * Convert an attestation type number to the corresponding attestation type string 654 * Convert an credential type number to the corresponding credential type string
573 * 655 *
574 * @param type number of a type 656 * @param type number of a type
575 * @return corresponding typestring, NULL on error 657 * @return corresponding typestring, NULL on error
576 */ 658 */
577const char * 659const char *
578GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type); 660GNUNET_RECLAIM_credential_number_to_typename (uint32_t type);
579 661
580/** 662/**
581 * Convert an attestation type name to the corresponding number 663 * Convert an credential type name to the corresponding number
582 * 664 *
583 * @param typename name to convert 665 * @param typename name to convert
584 * @return corresponding number, UINT32_MAX on error 666 * @return corresponding number, UINT32_MAX on error
585 */ 667 */
586uint32_t 668uint32_t
587GNUNET_RECLAIM_attestation_typename_to_number (const char *typename); 669GNUNET_RECLAIM_credential_typename_to_number (const char *typename);
588 670
589/** 671/**
590 * Convert an attestation type name to the corresponding number 672 * Convert an credential type name to the corresponding number
591 * 673 *
592 * @param typename name to convert 674 * @param typename name to convert
593 * @return corresponding number, UINT32_MAX on error 675 * @return corresponding number, UINT32_MAX on error
594 */ 676 */
595struct GNUNET_RECLAIM_AttributeList* 677struct GNUNET_RECLAIM_AttributeList*
596GNUNET_RECLAIM_attestation_get_attributes (const struct 678GNUNET_RECLAIM_credential_get_attributes (const struct
597 GNUNET_RECLAIM_Attestation *attest); 679 GNUNET_RECLAIM_Credential *cred);
680
681char*
682GNUNET_RECLAIM_credential_get_issuer (const struct
683 GNUNET_RECLAIM_Credential *cred);
684
685int
686GNUNET_RECLAIM_credential_get_expiration (const struct
687 GNUNET_RECLAIM_Credential *cred,
688 struct GNUNET_TIME_Absolute *exp);
689
690/**
691 * Get required size for serialization buffer
692 *
693 * @param presentations the presentation list to serialize
694 * @return the required buffer size
695 */
696size_t
697GNUNET_RECLAIM_presentation_list_serialize_get_size (
698 const struct GNUNET_RECLAIM_PresentationList *presentations);
699
700
701/**
702 * Destroy presentations list
703 *
704 * @param presentations list to destroy
705 */
706void
707GNUNET_RECLAIM_presentation_list_destroy (
708 struct GNUNET_RECLAIM_PresentationList *presentations);
709
710
711/**
712 * Serialize a presentation list
713 *
714 * @param presentations the attribute list to serialize
715 * @param result the serialized list
716 * @return length of serialized data
717 */
718size_t
719GNUNET_RECLAIM_presentation_list_serialize (
720 const struct GNUNET_RECLAIM_PresentationList *presentations,
721 char *result);
722
723
724/**
725 * Deserialize a presentation list
726 *
727 * @param data the serialized list
728 * @param data_size the length of the serialized data
729 * @return a GNUNET_RECLAIM_PresentationList, must be free'd by caller
730 */
731struct GNUNET_RECLAIM_PresentationList *
732GNUNET_RECLAIM_presentation_list_deserialize (const char *data,
733 size_t data_size);
734
735
736/**
737 * @param presentation the presentation to serialize
738 * @return the required buffer size
739 */
740size_t
741GNUNET_RECLAIM_presentation_serialize_get_size (
742 const struct GNUNET_RECLAIM_Presentation *presentation);
743
744
745/**
746 * Serialize a presentation.
747 *
748 * @param presentation the presentation to serialize
749 * @param result the serialized presentation
750 * @return length of serialized data
751 */
752size_t
753GNUNET_RECLAIM_presentation_serialize (
754 const struct GNUNET_RECLAIM_Presentation *presentation,
755 char *result);
756
757
758/**
759 * Deserialize a presentation
760 *
761 * @param data the serialized presentation
762 * @param data_size the length of the serialized data
763 *
764 * @return a GNUNET_RECLAIM_Presentation, must be free'd by caller
765 */
766struct GNUNET_RECLAIM_Presentation *
767GNUNET_RECLAIM_presentation_deserialize (const char *data, size_t data_size);
768
769
770/**
771 * Convert the 'claim' of a presentation to a string
772 *
773 * @param type the type of presentation
774 * @param data presentation in binary encoding
775 * @param data_size number of bytes in @a data
776 * @return NULL on error, otherwise human-readable representation of the claim
777 */
778char *
779GNUNET_RECLAIM_presentation_value_to_string (uint32_t type,
780 const void *data,
781 size_t data_size);
782
783struct GNUNET_RECLAIM_Presentation *
784GNUNET_RECLAIM_presentation_new (uint32_t type,
785 const void *data,
786 size_t data_size);
787
788/**
789 * Convert human-readable version of a 'claim' of a presentation to the binary
790 * representation
791 *
792 * @param type type of the presentation
793 * @param s human-readable string
794 * @param data set to value in binary encoding (will be allocated)
795 * @param data_size set to number of bytes in @a data
796 * @return #GNUNET_OK on success
797 */
798int
799GNUNET_RECLAIM_presentation_string_to_value (uint32_t type,
800 const char *s,
801 void **data,
802 size_t *data_size);
803
804/**
805 * Convert a presentation type number to the corresponding credential type
806 * string.
807 *
808 * @param type number of a type
809 * @return corresponding typestring, NULL on error
810 */
811const char *
812GNUNET_RECLAIM_presentation_number_to_typename (uint32_t type);
813
814struct GNUNET_RECLAIM_AttributeList*
815GNUNET_RECLAIM_presentation_get_attributes (const struct
816 GNUNET_RECLAIM_Presentation *cred);
598 817
599char* 818char*
600GNUNET_RECLAIM_attestation_get_issuer (const struct 819GNUNET_RECLAIM_presentation_get_issuer (const struct
601 GNUNET_RECLAIM_Attestation *attest); 820 GNUNET_RECLAIM_Presentation *cred);
602 821
603int 822int
604GNUNET_RECLAIM_attestation_get_expiration (const struct 823GNUNET_RECLAIM_presentation_get_expiration (const struct
605 GNUNET_RECLAIM_Attestation *attest, 824 GNUNET_RECLAIM_Presentation *cred,
606 struct GNUNET_TIME_Absolute *exp); 825 struct GNUNET_TIME_Absolute *exp);
607 826
827
828
829/**
830 * Create a presentation from a credential and a lift of (selected)
831 * attributes in the credential.
832 * FIXME not yet implemented
833 *
834 * @param cred the credential to use
835 * @param attrs the attributes to present from the credential
836 * @param presentation the credential presentation presenting the attributes according
837 * to the presentation mechanism of the credential
838 * or NULL on error.
839 * @return GNUNET_OK on success.
840 */
841int
842GNUNET_RECLAIM_credential_get_presentation (
843 const struct GNUNET_RECLAIM_Credential *cred,
844 const struct GNUNET_RECLAIM_AttributeList *attrs,
845 struct GNUNET_RECLAIM_Presentation **presentation);
846
847
608#if 0 /* keep Emacsens' auto-indent happy */ 848#if 0 /* keep Emacsens' auto-indent happy */
609{ 849{
610#endif 850#endif
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h
index 7ee9e730f..2ba8fc8a0 100644
--- a/src/include/gnunet_reclaim_plugin.h
+++ b/src/include/gnunet_reclaim_plugin.h
@@ -27,8 +27,8 @@
27 * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims 27 * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims
28 * @{ 28 * @{
29 */ 29 */
30#ifndef GNUNET_RECLAIM_AttributePLUGIN_H 30#ifndef GNUNET_RECLAIM_PLUGIN_H
31#define GNUNET_RECLAIM_AttributePLUGIN_H 31#define GNUNET_RECLAIM_PLUGIN_H
32 32
33#include "gnunet_util_lib.h" 33#include "gnunet_util_lib.h"
34#include "gnunet_reclaim_lib.h" 34#include "gnunet_reclaim_lib.h"
@@ -113,7 +113,7 @@ typedef const char *(*GNUNET_RECLAIM_AttributeNumberToTypenameFunction) (
113 * @param data_size number of bytes in @a data 113 * @param data_size number of bytes in @a data
114 * @return NULL on error, otherwise human-readable representation of the value 114 * @return NULL on error, otherwise human-readable representation of the value
115 */ 115 */
116typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) ( 116typedef char *(*GNUNET_RECLAIM_CredentialValueToStringFunction) (
117 void *cls, 117 void *cls,
118 uint32_t type, 118 uint32_t type,
119 const void *data, 119 const void *data,
@@ -132,7 +132,7 @@ typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) (
132 * @param data_size set to number of bytes in @a data 132 * @param data_size set to number of bytes in @a data
133 * @return #GNUNET_OK on success 133 * @return #GNUNET_OK on success
134 */ 134 */
135typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) ( 135typedef int (*GNUNET_RECLAIM_CredentialStringToValueFunction) (
136 void *cls, 136 void *cls,
137 uint32_t type, 137 uint32_t type,
138 const char *s, 138 const char *s,
@@ -148,7 +148,7 @@ typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) (
148 * @param typename name to convert 148 * @param typename name to convert
149 * @return corresponding number, UINT32_MAX on error 149 * @return corresponding number, UINT32_MAX on error
150 */ 150 */
151typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) ( 151typedef uint32_t (*GNUNET_RECLAIM_CredentialTypenameToNumberFunction) (
152 void *cls, 152 void *cls,
153 const char *typename); 153 const char *typename);
154 154
@@ -161,47 +161,151 @@ typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) (
161 * @param type number of a type to convert 161 * @param type number of a type to convert
162 * @return corresponding typestring, NULL on error 162 * @return corresponding typestring, NULL on error
163 */ 163 */
164typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) ( 164typedef const char *(*GNUNET_RECLAIM_CredentialNumberToTypenameFunction) (
165 void *cls, 165 void *cls,
166 uint32_t type); 166 uint32_t type);
167 167
168/** 168/**
169 * Function called to extract attributes from an attestation 169 * Function called to extract attributes from a credential
170 * 170 *
171 * @param cls closure 171 * @param cls closure
172 * @param attest the attestation object 172 * @param cred the credential object
173 * @return an attribute list 173 * @return an attribute list
174 */ 174 */
175typedef struct 175typedef struct
176 GNUNET_RECLAIM_AttributeList *(* 176 GNUNET_RECLAIM_AttributeList *(*
177GNUNET_RECLAIM_AttestationGetAttributesFunction) ( 177GNUNET_RECLAIM_CredentialGetAttributesFunction) (
178 void *cls, 178 void *cls,
179 const struct GNUNET_RECLAIM_Attestation *attest); 179 const struct GNUNET_RECLAIM_Credential *cred);
180 180
181/** 181/**
182 * Function called to get the issuer of the attestation (as string) 182 * Function called to get the issuer of the credential (as string)
183 * 183 *
184 * @param cls closure 184 * @param cls closure
185 * @param attest the attestation object 185 * @param cred the credential object
186 * @return corresponding issuer string 186 * @return corresponding issuer string
187 */ 187 */
188typedef char *(*GNUNET_RECLAIM_AttestationGetIssuerFunction) ( 188typedef char *(*GNUNET_RECLAIM_CredentialGetIssuerFunction) (
189 void *cls, 189 void *cls,
190 const struct GNUNET_RECLAIM_Attestation *attest); 190 const struct GNUNET_RECLAIM_Credential *cred);
191 191
192/** 192/**
193 * Function called to get the expiration of the attestation 193 * Function called to get the expiration of the credential
194 * 194 *
195 * @param cls closure 195 * @param cls closure
196 * @param attest the attestation object 196 * @param cred the credential object
197 * @param where to write the value 197 * @param where to write the value
198 * @return GNUNET_OK if successful 198 * @return GNUNET_OK if successful
199 */ 199 */
200typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) ( 200typedef int (*GNUNET_RECLAIM_CredentialGetExpirationFunction) (
201 void *cls, 201 void *cls,
202 const struct GNUNET_RECLAIM_Attestation *attest, 202 const struct GNUNET_RECLAIM_Credential *cred,
203 struct GNUNET_TIME_Absolute *expiration); 203 struct GNUNET_TIME_Absolute *expiration);
204 204
205/**
206 * Function called to convert the binary value @a data of an attribute of
207 * type @a type to a human-readable string.
208 *
209 * @param cls closure
210 * @param type type of the attribute
211 * @param data value in binary encoding
212 * @param data_size number of bytes in @a data
213 * @return NULL on error, otherwise human-readable representation of the value
214 */
215typedef char *(*GNUNET_RECLAIM_PresentationValueToStringFunction) (
216 void *cls,
217 uint32_t type,
218 const void *data,
219 size_t data_size);
220
221
222/**
223 * Function called to convert human-readable version of the value @a s
224 * of an attribute of type @a type to the respective binary
225 * representation.
226 *
227 * @param cls closure
228 * @param type type of the attribute
229 * @param s human-readable string
230 * @param data set to value in binary encoding (will be allocated)
231 * @param data_size set to number of bytes in @a data
232 * @return #GNUNET_OK on success
233 */
234typedef int (*GNUNET_RECLAIM_PresentationStringToValueFunction) (
235 void *cls,
236 uint32_t type,
237 const char *s,
238 void **data,
239 size_t *data_size);
240
241
242/**
243 * Function called to convert a type name to the
244 * corresponding number.
245 *
246 * @param cls closure
247 * @param typename name to convert
248 * @return corresponding number, UINT32_MAX on error
249 */
250typedef uint32_t (*GNUNET_RECLAIM_PresentationTypenameToNumberFunction) (
251 void *cls,
252 const char *typename);
253
254
255/**
256 * Function called to convert a type number (i.e. 1) to the
257 * corresponding type string
258 *
259 * @param cls closure
260 * @param type number of a type to convert
261 * @return corresponding typestring, NULL on error
262 */
263typedef const char *(*GNUNET_RECLAIM_PresentationNumberToTypenameFunction) (
264 void *cls,
265 uint32_t type);
266
267/**
268 * Function called to extract attributes from a credential
269 *
270 * @param cls closure
271 * @param cred the credential object
272 * @return an attribute list
273 */
274typedef struct
275 GNUNET_RECLAIM_AttributeList *(*
276GNUNET_RECLAIM_PresentationGetAttributesFunction) (
277 void *cls,
278 const struct GNUNET_RECLAIM_Presentation *cred);
279
280/**
281 * Function called to get the issuer of the credential (as string)
282 *
283 * @param cls closure
284 * @param cred the credential object
285 * @return corresponding issuer string
286 */
287typedef char *(*GNUNET_RECLAIM_PresentationGetIssuerFunction) (
288 void *cls,
289 const struct GNUNET_RECLAIM_Presentation *cred);
290
291/**
292 * Function called to get the expiration of the credential
293 *
294 * @param cls closure
295 * @param cred the credential object
296 * @param where to write the value
297 * @return GNUNET_OK if successful
298 */
299typedef int (*GNUNET_RECLAIM_PresentationGetExpirationFunction) (
300 void *cls,
301 const struct GNUNET_RECLAIM_Presentation *cred,
302 struct GNUNET_TIME_Absolute *expiration);
303
304typedef int (*GNUNET_RECLAIM_CredentialToPresentation) (
305 void *cls,
306 const struct GNUNET_RECLAIM_Credential *cred,
307 const struct GNUNET_RECLAIM_AttributeList *attrs,
308 struct GNUNET_RECLAIM_Presentation **presentation);
205 309
206/** 310/**
207 * Each plugin is required to return a pointer to a struct of this 311 * Each plugin is required to return a pointer to a struct of this
@@ -240,7 +344,7 @@ struct GNUNET_RECLAIM_AttributePluginFunctions
240 * Each plugin is required to return a pointer to a struct of this 344 * Each plugin is required to return a pointer to a struct of this
241 * type as the return value from its entry point. 345 * type as the return value from its entry point.
242 */ 346 */
243struct GNUNET_RECLAIM_AttestationPluginFunctions 347struct GNUNET_RECLAIM_CredentialPluginFunctions
244{ 348{
245 /** 349 /**
246 * Closure for all of the callbacks. 350 * Closure for all of the callbacks.
@@ -250,37 +354,78 @@ struct GNUNET_RECLAIM_AttestationPluginFunctions
250 /** 354 /**
251 * Conversion to string. 355 * Conversion to string.
252 */ 356 */
253 GNUNET_RECLAIM_AttestationValueToStringFunction value_to_string; 357 GNUNET_RECLAIM_CredentialValueToStringFunction value_to_string;
358
359 /**
360 * Conversion to binary.
361 */
362 GNUNET_RECLAIM_CredentialStringToValueFunction string_to_value;
363
364 /**
365 * Typename to number.
366 */
367 GNUNET_RECLAIM_CredentialTypenameToNumberFunction typename_to_number;
368
369 /**
370 * Number to typename.
371 */
372 GNUNET_RECLAIM_CredentialNumberToTypenameFunction number_to_typename;
373
374 /**
375 * Attesation attributes.
376 */
377 GNUNET_RECLAIM_CredentialGetAttributesFunction get_attributes;
378
379 /**
380 * Attesation issuer.
381 */
382 GNUNET_RECLAIM_CredentialGetIssuerFunction get_issuer;
383
384 /**
385 * Expiration.
386 */
387 GNUNET_RECLAIM_CredentialGetExpirationFunction get_expiration;
388
389 /**
390 * Conversion to string.
391 */
392 GNUNET_RECLAIM_PresentationValueToStringFunction value_to_string_p;
254 393
255 /** 394 /**
256 * Conversion to binary. 395 * Conversion to binary.
257 */ 396 */
258 GNUNET_RECLAIM_AttestationStringToValueFunction string_to_value; 397 GNUNET_RECLAIM_PresentationStringToValueFunction string_to_value_p;
259 398
260 /** 399 /**
261 * Typename to number. 400 * Typename to number.
262 */ 401 */
263 GNUNET_RECLAIM_AttestationTypenameToNumberFunction typename_to_number; 402 GNUNET_RECLAIM_PresentationTypenameToNumberFunction typename_to_number_p;
264 403
265 /** 404 /**
266 * Number to typename. 405 * Number to typename.
267 */ 406 */
268 GNUNET_RECLAIM_AttestationNumberToTypenameFunction number_to_typename; 407 GNUNET_RECLAIM_PresentationNumberToTypenameFunction number_to_typename_p;
269 408
270 /** 409 /**
271 * Attesation attributes. 410 * Attesation attributes.
272 */ 411 */
273 GNUNET_RECLAIM_AttestationGetAttributesFunction get_attributes; 412 GNUNET_RECLAIM_PresentationGetAttributesFunction get_attributes_p;
274 413
275 /** 414 /**
276 * Attesation issuer. 415 * Attesation issuer.
277 */ 416 */
278 GNUNET_RECLAIM_AttestationGetIssuerFunction get_issuer; 417 GNUNET_RECLAIM_PresentationGetIssuerFunction get_issuer_p;
279 418
280 /** 419 /**
281 * Expiration. 420 * Expiration.
282 */ 421 */
283 GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration; 422 GNUNET_RECLAIM_PresentationGetExpirationFunction get_expiration_p;
423
424 /**
425 * Get presentation
426 */
427 GNUNET_RECLAIM_CredentialToPresentation create_presentation;
428
284}; 429};
285 430
286 431
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h
index 139c44ae7..368058f56 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -92,7 +92,21 @@ struct GNUNET_RECLAIM_Ticket
92 * @param ticket the ticket 92 * @param ticket the ticket
93 */ 93 */
94typedef void (*GNUNET_RECLAIM_TicketCallback) ( 94typedef void (*GNUNET_RECLAIM_TicketCallback) (
95 void *cls, const struct GNUNET_RECLAIM_Ticket *ticket); 95 void *cls,
96 const struct GNUNET_RECLAIM_Ticket *ticket);
97
98/**
99 * Method called when a token has been issued.
100 * On success returns a ticket that can be given to a relying party
101 * in order for it retrive identity attributes
102 *
103 * @param cls closure
104 * @param ticket the ticket
105 */
106typedef void (*GNUNET_RECLAIM_IssueTicketCallback) (
107 void *cls,
108 const struct GNUNET_RECLAIM_Ticket *ticket,
109 const struct GNUNET_RECLAIM_PresentationList *presentations);
96 110
97 111
98/** 112/**
@@ -113,7 +127,6 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
113 * @param cls The callback closure 127 * @param cls The callback closure
114 * @param identity The identity authoritative over the attributes 128 * @param identity The identity authoritative over the attributes
115 * @param attr The attribute 129 * @param attr The attribute
116 * @param attestation The attestation for the attribute (may be NULL)
117 */ 130 */
118typedef void (*GNUNET_RECLAIM_AttributeResult) ( 131typedef void (*GNUNET_RECLAIM_AttributeResult) (
119 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 132 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
@@ -125,25 +138,25 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) (
125 * @param cls The callback closure 138 * @param cls The callback closure
126 * @param identity The identity authoritative over the attributes 139 * @param identity The identity authoritative over the attributes
127 * @param attr The attribute 140 * @param attr The attribute
128 * @param attestation The attestation for the attribute (may be NULL) 141 * @param presentation The presentation for the credential (may be NULL)
129 */ 142 */
130typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( 143typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
131 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 144 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
132 const struct GNUNET_RECLAIM_Attribute *attr, 145 const struct GNUNET_RECLAIM_Attribute *attr,
133 const struct GNUNET_RECLAIM_Attestation *attestation); 146 const struct GNUNET_RECLAIM_Presentation *presentation);
134 147
135 148
136/** 149/**
137 * Callback used to notify the client of attestation results. 150 * Callback used to notify the client of credential results.
138 * 151 *
139 * @param cls The callback closure 152 * @param cls The callback closure
140 * @param identity The identity authoritative over the attributes 153 * @param identity The identity authoritative over the attributes
141 * @param attestation The attestation 154 * @param credential The credential
142 * @param attributes the parsed attributes 155 * @param attributes the parsed attributes
143 */ 156 */
144typedef void (*GNUNET_RECLAIM_AttestationResult) ( 157typedef void (*GNUNET_RECLAIM_CredentialResult) (
145 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 158 void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
146 const struct GNUNET_RECLAIM_Attestation *attestation); 159 const struct GNUNET_RECLAIM_Credential *credential);
147 160
148 161
149/** 162/**
@@ -178,22 +191,22 @@ GNUNET_RECLAIM_attribute_store (
178 191
179 192
180/** 193/**
181 * Store an attestation. If the attestation is already present, 194 * Store a credential. If the credential is already present,
182 * it is replaced with the new attestation. 195 * it is replaced with the new credential.
183 * 196 *
184 * @param h handle to the re:claimID service 197 * @param h handle to the re:claimID service
185 * @param pkey private key of the identity 198 * @param pkey private key of the identity
186 * @param attr the attestation value 199 * @param attr the credential value
187 * @param exp_interval the relative expiration interval for the attestation 200 * @param exp_interval the relative expiration interval for the credential
188 * @param cont continuation to call when done 201 * @param cont continuation to call when done
189 * @param cont_cls closure for @a cont 202 * @param cont_cls closure for @a cont
190 * @return handle to abort the request 203 * @return handle to abort the request
191 */ 204 */
192struct GNUNET_RECLAIM_Operation * 205struct GNUNET_RECLAIM_Operation *
193GNUNET_RECLAIM_attestation_store ( 206GNUNET_RECLAIM_credential_store (
194 struct GNUNET_RECLAIM_Handle *h, 207 struct GNUNET_RECLAIM_Handle *h,
195 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 208 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
196 const struct GNUNET_RECLAIM_Attestation *attestation, 209 const struct GNUNET_RECLAIM_Credential *credential,
197 const struct GNUNET_TIME_Relative *exp_interval, 210 const struct GNUNET_TIME_Relative *exp_interval,
198 GNUNET_RECLAIM_ContinuationWithStatus cont, 211 GNUNET_RECLAIM_ContinuationWithStatus cont,
199 void *cont_cls); 212 void *cont_cls);
@@ -218,21 +231,21 @@ GNUNET_RECLAIM_attribute_delete (
218 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); 231 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
219 232
220/** 233/**
221 * Delete an attestation. Tickets used to share this attestation are updated 234 * Delete a credential. Tickets used to share use a presentation of this
222 * accordingly. 235 * credential are updated accordingly.
223 * 236 *
224 * @param h handle to the re:claimID service 237 * @param h handle to the re:claimID service
225 * @param pkey Private key of the identity to add an attribute to 238 * @param pkey Private key of the identity to add an attribute to
226 * @param attr The attestation 239 * @param cred The credential
227 * @param cont Continuation to call when done 240 * @param cont Continuation to call when done
228 * @param cont_cls Closure for @a cont 241 * @param cont_cls Closure for @a cont
229 * @return handle Used to to abort the request 242 * @return handle Used to to abort the request
230 */ 243 */
231struct GNUNET_RECLAIM_Operation * 244struct GNUNET_RECLAIM_Operation *
232GNUNET_RECLAIM_attestation_delete ( 245GNUNET_RECLAIM_credential_delete (
233 struct GNUNET_RECLAIM_Handle *h, 246 struct GNUNET_RECLAIM_Handle *h,
234 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 247 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
235 const struct GNUNET_RECLAIM_Attestation *attr, 248 const struct GNUNET_RECLAIM_Credential *cred,
236 GNUNET_RECLAIM_ContinuationWithStatus cont, 249 GNUNET_RECLAIM_ContinuationWithStatus cont,
237 void *cont_cls); 250 void *cont_cls);
238 251
@@ -293,12 +306,12 @@ GNUNET_RECLAIM_get_attributes_stop (
293 306
294 307
295/** 308/**
296 * List all attestations for a local identity. 309 * List all credentials for a local identity.
297 * This MUST lock the `struct GNUNET_RECLAIM_Handle` 310 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
298 * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and 311 * for any other calls than #GNUNET_RECLAIM_get_credentials_next() and
299 * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once 312 * #GNUNET_RECLAIM_get_credentials_stop. @a proc will be called once
300 * immediately, and then again after 313 * immediately, and then again after
301 * #GNUNET_RECLAIM_get_attestations_next() is invoked. 314 * #GNUNET_RECLAIM_get_credentials_next() is invoked.
302 * 315 *
303 * On error (disconnect), @a error_cb will be invoked. 316 * On error (disconnect), @a error_cb will be invoked.
304 * On normal completion, @a finish_cb proc will be 317 * On normal completion, @a finish_cb proc will be
@@ -309,34 +322,34 @@ GNUNET_RECLAIM_get_attributes_stop (
309 * @param error_cb Function to call on error (i.e. disconnect), 322 * @param error_cb Function to call on error (i.e. disconnect),
310 * the handle is afterwards invalid 323 * the handle is afterwards invalid
311 * @param error_cb_cls Closure for @a error_cb 324 * @param error_cb_cls Closure for @a error_cb
312 * @param proc Function to call on each attestation 325 * @param proc Function to call on each credential
313 * @param proc_cls Closure for @a proc 326 * @param proc_cls Closure for @a proc
314 * @param finish_cb Function to call on completion 327 * @param finish_cb Function to call on completion
315 * the handle is afterwards invalid 328 * the handle is afterwards invalid
316 * @param finish_cb_cls Closure for @a finish_cb 329 * @param finish_cb_cls Closure for @a finish_cb
317 * @return an iterator Handle to use for iteration 330 * @return an iterator Handle to use for iteration
318 */ 331 */
319struct GNUNET_RECLAIM_AttestationIterator * 332struct GNUNET_RECLAIM_CredentialIterator *
320GNUNET_RECLAIM_get_attestations_start ( 333GNUNET_RECLAIM_get_credentials_start (
321 struct GNUNET_RECLAIM_Handle *h, 334 struct GNUNET_RECLAIM_Handle *h,
322 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 335 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
323 GNUNET_SCHEDULER_TaskCallback error_cb, 336 GNUNET_SCHEDULER_TaskCallback error_cb,
324 void *error_cb_cls, 337 void *error_cb_cls,
325 GNUNET_RECLAIM_AttestationResult proc, 338 GNUNET_RECLAIM_CredentialResult proc,
326 void *proc_cls, 339 void *proc_cls,
327 GNUNET_SCHEDULER_TaskCallback finish_cb, 340 GNUNET_SCHEDULER_TaskCallback finish_cb,
328 void *finish_cb_cls); 341 void *finish_cb_cls);
329 342
330 343
331/** 344/**
332 * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start 345 * Calls the record processor specified in #GNUNET_RECLAIM_get_credentials_start
333 * for the next record. 346 * for the next record.
334 * 347 *
335 * @param it the iterator 348 * @param it the iterator
336 */ 349 */
337void 350void
338GNUNET_RECLAIM_get_attestations_next (struct 351GNUNET_RECLAIM_get_credentials_next (
339 GNUNET_RECLAIM_AttestationIterator *ait); 352 struct GNUNET_RECLAIM_CredentialIterator *ait);
340 353
341 354
342/** 355/**
@@ -347,8 +360,8 @@ GNUNET_RECLAIM_get_attestations_next (struct
347 * @param it the iterator 360 * @param it the iterator
348 */ 361 */
349void 362void
350GNUNET_RECLAIM_get_attestations_stop (struct 363GNUNET_RECLAIM_get_credentials_stop (
351 GNUNET_RECLAIM_AttestationIterator *ait); 364 struct GNUNET_RECLAIM_CredentialIterator *ait);
352 365
353 366
354/** 367/**
@@ -370,7 +383,7 @@ GNUNET_RECLAIM_ticket_issue (
370 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 383 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
371 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 384 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
372 const struct GNUNET_RECLAIM_AttributeList *attrs, 385 const struct GNUNET_RECLAIM_AttributeList *attrs,
373 GNUNET_RECLAIM_TicketCallback cb, void *cb_cls); 386 GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls);
374 387
375 388
376/** 389/**
diff --git a/src/include/gnunet_seti_service.h b/src/include/gnunet_seti_service.h
new file mode 100644
index 000000000..c0b6f41a5
--- /dev/null
+++ b/src/include/gnunet_seti_service.h
@@ -0,0 +1,369 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2020 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 * @author Florian Dold
22 * @author Christian Grothoff
23 *
24 * @file
25 * Two-peer set intersection operations
26 *
27 * @defgroup set Set intersection service
28 * Two-peer set operations
29 *
30 * @{
31 */
32
33#ifndef GNUNET_SETI_SERVICE_H
34#define GNUNET_SETI_SERVICE_H
35
36#ifdef __cplusplus
37extern "C"
38{
39#if 0 /* keep Emacsens' auto-indent happy */
40}
41#endif
42#endif
43
44#include "gnunet_common.h"
45#include "gnunet_time_lib.h"
46#include "gnunet_configuration_lib.h"
47
48
49/**
50 * Maximum size of a context message for set operation requests.
51 */
52#define GNUNET_SETI_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024)
53
54/**
55 * Opaque handle to a set.
56 */
57struct GNUNET_SETI_Handle;
58
59/**
60 * Opaque handle to a set operation request from another peer.
61 */
62struct GNUNET_SETI_Request;
63
64/**
65 * Opaque handle to a listen operation.
66 */
67struct GNUNET_SETI_ListenHandle;
68
69/**
70 * Opaque handle to a set operation.
71 */
72struct GNUNET_SETI_OperationHandle;
73
74
75/**
76 * Status for the result callback
77 */
78enum GNUNET_SETI_Status
79{
80
81 /**
82 * Element should be added to the result set of the local peer, i.e. the
83 * element is in the intersection.
84 */
85 GNUNET_SETI_STATUS_ADD_LOCAL,
86
87 /**
88 * Element should be delete from the result set of the local peer, i.e. the
89 * local peer is having an element that is not in the intersection.
90 */
91 GNUNET_SETI_STATUS_DEL_LOCAL,
92
93 /**
94 * The other peer refused to do the operation with us, or something went
95 * wrong.
96 */
97 GNUNET_SETI_STATUS_FAILURE,
98
99 /**
100 * Success, all elements have been sent (and received).
101 */
102 GNUNET_SETI_STATUS_DONE
103};
104
105
106/**
107 * Element stored in a set.
108 */
109struct GNUNET_SETI_Element
110{
111 /**
112 * Number of bytes in the buffer pointed to by data.
113 */
114 uint16_t size;
115
116 /**
117 * Application-specific element type.
118 */
119 uint16_t element_type;
120
121 /**
122 * Actual data of the element
123 */
124 const void *data;
125};
126
127
128/**
129 * Possible options to pass to a set operation.
130 *
131 * Used as tag for struct #GNUNET_SETI_Option.
132 */
133enum GNUNET_SETI_OptionType
134{
135 /**
136 * List terminator.
137 */
138 GNUNET_SETI_OPTION_END = 0,
139
140 /**
141 * Return the elements remaining in the intersection
142 * (#GNUNET_SETI_STATUS_ADD_LOCAL). If not given, the default is to return a
143 * list of the elements to be removed (#GNUNET_SETI_STATUS_DEL_LOCAL).
144 */
145 GNUNET_SETI_OPTION_RETURN_INTERSECTION = 1,
146};
147
148
149/**
150 * Option for set operations.
151 */
152struct GNUNET_SETI_Option
153{
154 /**
155 * Type of the option.
156 */
157 enum GNUNET_SETI_OptionType type;
158
159 /**
160 * Value for the option, only used with some options.
161 */
162 union
163 {
164 uint64_t num;
165 } v;
166};
167
168
169/**
170 * Callback for set union operation results. Called for each element
171 * in the result set.
172 *
173 * @param cls closure
174 * @param element a result element, only valid if status is #GNUNET_SETI_STATUS_OK
175 * @param current_size current set size
176 * @param status see `enum GNUNET_SETI_Status`
177 */
178typedef void
179(*GNUNET_SETI_ResultIterator) (void *cls,
180 const struct GNUNET_SETI_Element *element,
181 uint64_t current_size,
182 enum GNUNET_SETI_Status status);
183
184
185/**
186 * Called when another peer wants to do a set operation with the
187 * local peer. If a listen error occurs, the @a request is NULL.
188 *
189 * @param cls closure
190 * @param other_peer the other peer
191 * @param context_msg message with application specific information from
192 * the other peer
193 * @param request request from the other peer (never NULL), use GNUNET_SETI_accept()
194 * to accept it, otherwise the request will be refused
195 * Note that we can't just return value from the listen callback,
196 * as it is also necessary to specify the set we want to do the
197 * operation with, whith sometimes can be derived from the context
198 * message. It's necessary to specify the timeout.
199 */
200typedef void
201(*GNUNET_SETI_ListenCallback) (void *cls,
202 const struct GNUNET_PeerIdentity *other_peer,
203 const struct GNUNET_MessageHeader *context_msg,
204 struct GNUNET_SETI_Request *request);
205
206
207/**
208 * Create an empty set, supporting the specified operation.
209 *
210 * @param cfg configuration to use for connecting to the
211 * set service
212 * @return a handle to the set
213 */
214struct GNUNET_SETI_Handle *
215GNUNET_SETI_create (const struct GNUNET_CONFIGURATION_Handle *cfg);
216
217
218/**
219 * Add an element to the given set.
220 *
221 * @param set set to add element to
222 * @param element element to add to the set
223 * @param cb function to call when finished, can be NULL
224 * @param cb_cls closure for @a cb
225 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
226 * set is invalid (e.g. the set service crashed)
227 */
228int
229GNUNET_SETI_add_element (struct GNUNET_SETI_Handle *set,
230 const struct GNUNET_SETI_Element *element,
231 GNUNET_SCHEDULER_TaskCallback cb,
232 void *cb_cls);
233
234
235/**
236 * Destroy the set handle, and free all associated resources. Operations may
237 * still be pending when a set is destroyed (and will be allowed to complete).
238 *
239 * @param set set to destroy
240 */
241void
242GNUNET_SETI_destroy (struct GNUNET_SETI_Handle *set);
243
244
245/**
246 * Prepare a set operation to be evaluated with another peer. The evaluation
247 * will not start until the client provides a local set with
248 * GNUNET_SETI_commit().
249 *
250 * @param other_peer peer with the other set
251 * @param app_id hash for the application using the set
252 * @param context_msg additional information for the request
253 * @param options options to use when processing the request
254 * @param result_cb called on error or success
255 * @param result_cls closure for @a result_cb
256 * @return a handle to cancel the operation
257 */
258struct GNUNET_SETI_OperationHandle *
259GNUNET_SETI_prepare (const struct GNUNET_PeerIdentity *other_peer,
260 const struct GNUNET_HashCode *app_id,
261 const struct GNUNET_MessageHeader *context_msg,
262 const struct GNUNET_SETI_Option options[],
263 GNUNET_SETI_ResultIterator result_cb,
264 void *result_cls);
265
266
267/**
268 * Wait for set operation requests for the given application ID.
269 * If the connection to the set service is lost, the listener is
270 * re-created transparently with exponential backoff.
271 *
272 * @param cfg configuration to use for connecting to
273 * the set service
274 * @param app_id id of the application that handles set operation requests
275 * @param listen_cb called for each incoming request matching the operation
276 * and application id
277 * @param listen_cls handle for @a listen_cb
278 * @return a handle that can be used to cancel the listen operation
279 */
280struct GNUNET_SETI_ListenHandle *
281GNUNET_SETI_listen (const struct GNUNET_CONFIGURATION_Handle *cfg,
282 const struct GNUNET_HashCode *app_id,
283 GNUNET_SETI_ListenCallback listen_cb,
284 void *listen_cls);
285
286
287/**
288 * Cancel the given listen operation. After calling cancel, the
289 * listen callback for this listen handle will not be called again.
290 * Note that cancelling a listen operation will automatically reject
291 * all operations that have not yet been accepted.
292 *
293 * @param lh handle for the listen operation
294 */
295void
296GNUNET_SETI_listen_cancel (struct GNUNET_SETI_ListenHandle *lh);
297
298
299/**
300 * Accept a request we got via GNUNET_SETI_listen(). Must be called during
301 * GNUNET_SETI_listen(), as the `struct GNUNET_SETI_Request` becomes invalid
302 * afterwards.
303 * Call GNUNET_SETI_commit() to provide the local set to use for the operation,
304 * and to begin the exchange with the remote peer.
305 *
306 * @param request request to accept
307 * @param options options to use when processing the request
308 * @param result_cb callback for the results
309 * @param result_cls closure for @a result_cb
310 * @return a handle to cancel the operation
311 */
312struct GNUNET_SETI_OperationHandle *
313GNUNET_SETI_accept (struct GNUNET_SETI_Request *request,
314 const struct GNUNET_SETI_Option options[],
315 GNUNET_SETI_ResultIterator result_cb,
316 void *result_cls);
317
318
319/**
320 * Commit a set to be used with a set operation.
321 * This function is called once we have fully constructed
322 * the set that we want to use for the operation. At this
323 * time, the P2P protocol can then begin to exchange the
324 * set information and call the result callback with the
325 * result information.
326 *
327 * @param oh handle to the set operation
328 * @param set the set to use for the operation
329 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
330 * set is invalid (e.g. the set service crashed)
331 */
332int
333GNUNET_SETI_commit (struct GNUNET_SETI_OperationHandle *oh,
334 struct GNUNET_SETI_Handle *set);
335
336
337/**
338 * Cancel the given set operation. May not be called after the operation's
339 * `GNUNET_SETI_ResultIterator` has been called with a status of
340 * #GNUNET_SETI_STATUS_FAILURE or #GNUNET_SETI_STATUS_DONE.
341 *
342 * @param oh set operation to cancel
343 */
344void
345GNUNET_SETI_operation_cancel (struct GNUNET_SETI_OperationHandle *oh);
346
347
348/**
349 * Hash a set element.
350 *
351 * @param element the element that should be hashed
352 * @param[out] ret_hash a pointer to where the hash of @a element
353 * should be stored
354 */
355void
356GNUNET_SETI_element_hash (const struct GNUNET_SETI_Element *element,
357 struct GNUNET_HashCode *ret_hash);
358
359
360#if 0 /* keep Emacsens' auto-indent happy */
361{
362#endif
363#ifdef __cplusplus
364}
365#endif
366
367#endif
368
369/** @} */ /* end of group */
diff --git a/src/include/gnunet_setu_service.h b/src/include/gnunet_setu_service.h
new file mode 100644
index 000000000..634c5c40b
--- /dev/null
+++ b/src/include/gnunet_setu_service.h
@@ -0,0 +1,390 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2020 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 * @author Florian Dold
22 * @author Christian Grothoff
23 *
24 * @file
25 * Two-peer set union operations
26 *
27 * @defgroup set Set union service
28 * Two-peer set operations
29 *
30 * @{
31 */
32
33#ifndef GNUNET_SETU_SERVICE_H
34#define GNUNET_SETU_SERVICE_H
35
36#ifdef __cplusplus
37extern "C"
38{
39#if 0 /* keep Emacsens' auto-indent happy */
40}
41#endif
42#endif
43
44#include "gnunet_common.h"
45#include "gnunet_time_lib.h"
46#include "gnunet_configuration_lib.h"
47
48
49/**
50 * Maximum size of a context message for set operation requests.
51 */
52#define GNUNET_SETU_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024)
53
54/**
55 * Opaque handle to a set.
56 */
57struct GNUNET_SETU_Handle;
58
59/**
60 * Opaque handle to a set operation request from another peer.
61 */
62struct GNUNET_SETU_Request;
63
64/**
65 * Opaque handle to a listen operation.
66 */
67struct GNUNET_SETU_ListenHandle;
68
69/**
70 * Opaque handle to a set operation.
71 */
72struct GNUNET_SETU_OperationHandle;
73
74
75/**
76 * Status for the result callback
77 */
78enum GNUNET_SETU_Status
79{
80
81 /**
82 * Element should be added to the result set of the local peer, i.e. the
83 * local peer is missing an element.
84 */
85 GNUNET_SETU_STATUS_ADD_LOCAL,
86
87 /**
88 * Element should be added to the result set of the remote peer, i.e. the
89 * remote peer is missing an element. Only used if
90 * #GNUNET_SETU_OPTION_SYMMETRIC is set.
91 */
92 GNUNET_SETU_STATUS_ADD_REMOTE,
93
94 /**
95 * The other peer refused to do the operation with us, or something went
96 * wrong.
97 */
98 GNUNET_SETU_STATUS_FAILURE,
99
100 /**
101 * Success, all elements have been sent (and received).
102 */
103 GNUNET_SETU_STATUS_DONE
104};
105
106
107/**
108 * Element stored in a set.
109 */
110struct GNUNET_SETU_Element
111{
112 /**
113 * Number of bytes in the buffer pointed to by data.
114 */
115 uint16_t size;
116
117 /**
118 * Application-specific element type.
119 */
120 uint16_t element_type;
121
122 /**
123 * Actual data of the element
124 */
125 const void *data;
126};
127
128
129/**
130 * Possible options to pass to a set operation.
131 *
132 * Used as tag for struct #GNUNET_SETU_Option.
133 */
134enum GNUNET_SETU_OptionType
135{
136 /**
137 * List terminator.
138 */
139 GNUNET_SETU_OPTION_END=0,
140
141 /**
142 * Fail set operations when the other peer shows weird behavior
143 * that might by a Byzantine fault.
144 *
145 * For set union, 'v.num' is a lower bound on elements that the other peer
146 * must have in common with us.
147 */
148 GNUNET_SETU_OPTION_BYZANTINE=1,
149
150 /**
151 * Do not use the optimized set operation, but send full sets. Might
152 * trigger Byzantine fault detection.
153 */
154 GNUNET_SETU_OPTION_FORCE_FULL=2,
155
156 /**
157 * Only use optimized set operations, even though for this particular set
158 * operation they might be much slower. Might trigger Byzantine fault
159 * detection.
160 */
161 GNUNET_SETU_OPTION_FORCE_DELTA=4,
162
163 /**
164 * Notify client also if we are sending a value to the other peer.
165 */
166 GNUNET_SETU_OPTION_SYMMETRIC = 8
167};
168
169
170/**
171 * Option for set operations.
172 */
173struct GNUNET_SETU_Option
174{
175 /**
176 * Type of the option.
177 */
178 enum GNUNET_SETU_OptionType type;
179
180 /**
181 * Value for the option, only used with some options.
182 */
183 union
184 {
185 uint64_t num;
186 } v;
187};
188
189
190/**
191 * Callback for set union operation results. Called for each element
192 * in the result set.
193 *
194 * @param cls closure
195 * @param element a result element, only valid if status is #GNUNET_SETU_STATUS_OK
196 * @param current_size current set size
197 * @param status see `enum GNUNET_SETU_Status`
198 */
199typedef void
200(*GNUNET_SETU_ResultIterator) (void *cls,
201 const struct GNUNET_SETU_Element *element,
202 uint64_t current_size,
203 enum GNUNET_SETU_Status status);
204
205
206/**
207 * Called when another peer wants to do a set operation with the
208 * local peer. If a listen error occurs, the @a request is NULL.
209 *
210 * @param cls closure
211 * @param other_peer the other peer
212 * @param context_msg message with application specific information from
213 * the other peer
214 * @param request request from the other peer (never NULL), use GNUNET_SETU_accept()
215 * to accept it, otherwise the request will be refused
216 * Note that we can't just return value from the listen callback,
217 * as it is also necessary to specify the set we want to do the
218 * operation with, whith sometimes can be derived from the context
219 * message. It's necessary to specify the timeout.
220 */
221typedef void
222(*GNUNET_SETU_ListenCallback) (void *cls,
223 const struct GNUNET_PeerIdentity *other_peer,
224 const struct GNUNET_MessageHeader *context_msg,
225 struct GNUNET_SETU_Request *request);
226
227
228/**
229 * Create an empty set, supporting the specified operation.
230 *
231 * @param cfg configuration to use for connecting to the
232 * set service
233 * @return a handle to the set
234 */
235struct GNUNET_SETU_Handle *
236GNUNET_SETU_create (const struct GNUNET_CONFIGURATION_Handle *cfg);
237
238
239/**
240 * Add an element to the given set.
241 *
242 * @param set set to add element to
243 * @param element element to add to the set
244 * @param cb function to call when finished, can be NULL
245 * @param cb_cls closure for @a cb
246 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
247 * set is invalid (e.g. the set service crashed)
248 */
249int
250GNUNET_SETU_add_element (struct GNUNET_SETU_Handle *set,
251 const struct GNUNET_SETU_Element *element,
252 GNUNET_SCHEDULER_TaskCallback cb,
253 void *cb_cls);
254
255
256/**
257 * Destroy the set handle, and free all associated resources. Operations may
258 * still be pending when a set is destroyed (and will be allowed to complete).
259 *
260 * @param set set to destroy
261 */
262void
263GNUNET_SETU_destroy (struct GNUNET_SETU_Handle *set);
264
265
266/**
267 * Prepare a set operation to be evaluated with another peer. The evaluation
268 * will not start until the client provides a local set with
269 * GNUNET_SETU_commit().
270 *
271 * @param other_peer peer with the other set
272 * @param app_id hash for the application using the set
273 * @param context_msg additional information for the request
274 * @param options options to use when processing the request
275 * @param result_cb called on error or success
276 * @param result_cls closure for @a result_cb
277 * @return a handle to cancel the operation
278 */
279struct GNUNET_SETU_OperationHandle *
280GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer,
281 const struct GNUNET_HashCode *app_id,
282 const struct GNUNET_MessageHeader *context_msg,
283 const struct GNUNET_SETU_Option options[],
284 GNUNET_SETU_ResultIterator result_cb,
285 void *result_cls);
286
287
288/**
289 * Wait for set operation requests for the given application ID.
290 * If the connection to the set service is lost, the listener is
291 * re-created transparently with exponential backoff.
292 *
293 * @param cfg configuration to use for connecting to
294 * the set service
295 * @param app_id id of the application that handles set operation requests
296 * @param listen_cb called for each incoming request matching the operation
297 * and application id
298 * @param listen_cls handle for @a listen_cb
299 * @return a handle that can be used to cancel the listen operation
300 */
301struct GNUNET_SETU_ListenHandle *
302GNUNET_SETU_listen (const struct GNUNET_CONFIGURATION_Handle *cfg,
303 const struct GNUNET_HashCode *app_id,
304 GNUNET_SETU_ListenCallback listen_cb,
305 void *listen_cls);
306
307
308/**
309 * Cancel the given listen operation. After calling cancel, the
310 * listen callback for this listen handle will not be called again.
311 * Note that cancelling a listen operation will automatically reject
312 * all operations that have not yet been accepted.
313 *
314 * @param lh handle for the listen operation
315 */
316void
317GNUNET_SETU_listen_cancel (struct GNUNET_SETU_ListenHandle *lh);
318
319
320/**
321 * Accept a request we got via GNUNET_SETU_listen(). Must be called during
322 * GNUNET_SETU_listen(), as the `struct GNUNET_SETU_Request` becomes invalid
323 * afterwards.
324 * Call GNUNET_SETU_commit() to provide the local set to use for the operation,
325 * and to begin the exchange with the remote peer.
326 *
327 * @param request request to accept
328 * @param options options to use when processing the request
329 * @param result_cb callback for the results
330 * @param result_cls closure for @a result_cb
331 * @return a handle to cancel the operation
332 */
333struct GNUNET_SETU_OperationHandle *
334GNUNET_SETU_accept (struct GNUNET_SETU_Request *request,
335 const struct GNUNET_SETU_Option options[],
336 GNUNET_SETU_ResultIterator result_cb,
337 void *result_cls);
338
339
340/**
341 * Commit a set to be used with a set operation.
342 * This function is called once we have fully constructed
343 * the set that we want to use for the operation. At this
344 * time, the P2P protocol can then begin to exchange the
345 * set information and call the result callback with the
346 * result information.
347 *
348 * @param oh handle to the set operation
349 * @param set the set to use for the operation
350 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
351 * set is invalid (e.g. the set service crashed)
352 */
353int
354GNUNET_SETU_commit (struct GNUNET_SETU_OperationHandle *oh,
355 struct GNUNET_SETU_Handle *set);
356
357
358/**
359 * Cancel the given set operation. May not be called after the operation's
360 * `GNUNET_SETU_ResultIterator` has been called with a status of
361 * #GNUNET_SETU_STATUS_FAILURE or #GNUNET_SETU_STATUS_DONE.
362 *
363 * @param oh set operation to cancel
364 */
365void
366GNUNET_SETU_operation_cancel (struct GNUNET_SETU_OperationHandle *oh);
367
368
369/**
370 * Hash a set element.
371 *
372 * @param element the element that should be hashed
373 * @param[out] ret_hash a pointer to where the hash of @a element
374 * should be stored
375 */
376void
377GNUNET_SETU_element_hash (const struct GNUNET_SETU_Element *element,
378 struct GNUNET_HashCode *ret_hash);
379
380
381#if 0 /* keep Emacsens' auto-indent happy */
382{
383#endif
384#ifdef __cplusplus
385}
386#endif
387
388#endif
389
390/** @} */ /* end of group */
diff --git a/src/include/gnunet_uri_lib.h b/src/include/gnunet_uri_lib.h
new file mode 100644
index 000000000..d428bdd9a
--- /dev/null
+++ b/src/include/gnunet_uri_lib.h
@@ -0,0 +1,122 @@
1/**
2 * Copyright (C) 2016 Jack Engqvist Johansson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22#ifndef GNUNET_URI_LIB_H
23#define GNUNET_URI_LIB_H
24
25
26/**
27 * The struct where the parsed values will be stored:
28 *
29 * scheme ":" [ "//" ] [ username ":" password "@" ] host [ ":" port ] [ "/" ] [ path ] [ "?" query ]
30 *
31 * Note: to make sure that no strings are copied, the first slash "/" in the
32 * path will be used to null terminate the hostname if no port is supplied.
33 */
34struct GNUNET_Uri {
35 char *scheme; /* scheme, without ":" and "//" */
36 char *username; /* username, default: NULL */
37 char *password; /* password, default: NULL */
38 char *host; /* hostname or IP address */
39 int port; /* port, default: 0 */
40 char *path; /* path, without leading "/", default: NULL */
41 char *query; /* query, default: NULL */
42 char *fragment; /* fragment, default: NULL */
43};
44
45
46/* A struct to hold the query string parameter values. */
47struct GNUNET_UriParam {
48 char *key;
49 char *val;
50};
51
52
53/**
54 * Parse a URL to a struct.
55 *
56 * The URL string should be in one of the following formats:
57 *
58 * Absolute URL:
59 * scheme ":" [ "//" ] [ username ":" password "@" ] host [ ":" port ] [ "/" ] [ path ] [ "?" query ] [ "#" fragment ]
60 *
61 * Relative URL:
62 * path [ "?" query ] [ "#" fragment ]
63 *
64 * The following parts will be parsed to the corresponding struct member.
65 *
66 * *url: a pointer to the struct where to store the parsed values.
67 * *url_str: a pointer to the url to be parsed (null terminated). The string
68 * will be modified.
69 *
70 * Returns 0 on success, otherwise -1.
71 */
72int
73GNUNET_uri_parse (struct GNUNET_Uri *url,
74 char *url_str);
75
76
77/**
78 * Split a path into several strings.
79 *
80 * No data is copied, the slashed are used as null terminators and then
81 * pointers to each path part will be stored in **parts. Double slashes will be
82 * treated as one.
83 *
84 * *path: the path to split. The string will be modified.
85 * **parts: a pointer to an array of (char *) where to store the result.
86 * max_parts: max number of parts to parse.
87 *
88 * Returns the number of parsed items. -1 on error.
89 */
90int
91GNUNET_uri_split_path (char *path,
92 char **parts,
93 int max_parts);
94
95
96/**
97 * Parse a query string into a key/value struct.
98 *
99 * The query string should be a null terminated string of parameters separated by
100 * a delimiter. Each parameter are checked for the equal sign character. If it
101 * appears in the parameter, it will be used as a null terminator and the part
102 * that comes after it will be the value of the parameter.
103 *
104 * No data are copied, the equal sign and delimiters are used as null
105 * terminators and then pointers to each parameter key and value will be stored
106 * in the yuarel_param struct.
107 *
108 * *query: the query string to parse. The string will be modified.
109 * delimiter: the character that separates the key/value pairs from eachother.
110 * *params: an array of (struct yuarel_param) where to store the result.
111 * max_values: max number of parameters to parse.
112 *
113 * Returns the number of parsed items. -1 on error.
114 */
115int
116GNUNET_uri_parse_query (char *query,
117 char delimiter,
118 struct GNUNET_UriParam *params,
119 int max_params);
120
121
122#endif /* GNUNET_URI_LIB_H */