diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/gnunet_buffer_lib.h | 3 | ||||
-rw-r--r-- | src/include/gnunet_common.h | 15 | ||||
-rw-r--r-- | src/include/gnunet_conversation_service.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 6 | ||||
-rw-r--r-- | src/include/gnunet_gns_service.h | 5 | ||||
-rw-r--r-- | src/include/gnunet_gnsrecord_json_lib.h | 73 | ||||
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 125 | ||||
-rw-r--r-- | src/include/gnunet_identity_service.h | 422 | ||||
-rw-r--r-- | src/include/gnunet_json_lib.h | 27 | ||||
-rw-r--r-- | src/include/gnunet_messenger_service.h | 436 | ||||
-rw-r--r-- | src/include/gnunet_namestore_plugin.h | 12 | ||||
-rw-r--r-- | src/include/gnunet_namestore_service.h | 15 | ||||
-rw-r--r-- | src/include/gnunet_pq_lib.h | 55 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 43 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_service.h | 33 | ||||
-rw-r--r-- | src/include/gnunet_revocation_service.h | 34 | ||||
-rw-r--r-- | src/include/gnunet_uri_lib.h | 8 |
18 files changed, 1207 insertions, 108 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 202abb7ac..fc3d745a6 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -62,6 +62,7 @@ gnunetinclude_HEADERS = \ | |||
62 | gnunet_json_lib.h \ | 62 | gnunet_json_lib.h \ |
63 | gnunet_load_lib.h \ | 63 | gnunet_load_lib.h \ |
64 | gnunet_cadet_service.h \ | 64 | gnunet_cadet_service.h \ |
65 | gnunet_messenger_service.h \ | ||
65 | gnunet_mhd_compat.h \ | 66 | gnunet_mhd_compat.h \ |
66 | gnunet_microphone_lib.h \ | 67 | gnunet_microphone_lib.h \ |
67 | gnunet_mst_lib.h \ | 68 | gnunet_mst_lib.h \ |
diff --git a/src/include/gnunet_buffer_lib.h b/src/include/gnunet_buffer_lib.h index 0c566df75..7239eccfb 100644 --- a/src/include/gnunet_buffer_lib.h +++ b/src/include/gnunet_buffer_lib.h | |||
@@ -147,7 +147,8 @@ GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str); | |||
147 | * @param ... format arguments | 147 | * @param ... format arguments |
148 | */ | 148 | */ |
149 | void | 149 | void |
150 | GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt, ...); | 150 | GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt, ...) |
151 | __attribute__ ((format (printf, 2, 3))); | ||
151 | 152 | ||
152 | 153 | ||
153 | /** | 154 | /** |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index fcaae1026..21b87b0f5 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -488,7 +488,8 @@ void | |||
488 | GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, | 488 | GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, |
489 | const char *comp, | 489 | const char *comp, |
490 | const char *message, | 490 | const char *message, |
491 | ...); | 491 | ...) |
492 | __attribute__ ((format (printf, 3, 4))); | ||
492 | 493 | ||
493 | #if ! defined(GNUNET_CULL_LOGGING) | 494 | #if ! defined(GNUNET_CULL_LOGGING) |
494 | #define GNUNET_log_from(kind, comp, ...) \ | 495 | #define GNUNET_log_from(kind, comp, ...) \ |
@@ -1445,6 +1446,7 @@ GNUNET_is_zero_ (const void *a, | |||
1445 | memcpy (&(arr1) [(len1) - (len2)], _a2, (len2) * sizeof (*arr1)); \ | 1446 | memcpy (&(arr1) [(len1) - (len2)], _a2, (len2) * sizeof (*arr1)); \ |
1446 | } while (0) | 1447 | } while (0) |
1447 | 1448 | ||
1449 | |||
1448 | /** | 1450 | /** |
1449 | * @ingroup memory | 1451 | * @ingroup memory |
1450 | * Like snprintf, just aborts if the buffer is of insufficient size. | 1452 | * Like snprintf, just aborts if the buffer is of insufficient size. |
@@ -1456,7 +1458,11 @@ GNUNET_is_zero_ (const void *a, | |||
1456 | * @return number of bytes written to buf or negative value on error | 1458 | * @return number of bytes written to buf or negative value on error |
1457 | */ | 1459 | */ |
1458 | int | 1460 | int |
1459 | GNUNET_snprintf (char *buf, size_t size, const char *format, ...); | 1461 | GNUNET_snprintf (char *buf, |
1462 | size_t size, | ||
1463 | const char *format, | ||
1464 | ...) | ||
1465 | __attribute__ ((format (printf, 3, 4))); | ||
1460 | 1466 | ||
1461 | 1467 | ||
1462 | /** | 1468 | /** |
@@ -1469,7 +1475,10 @@ GNUNET_snprintf (char *buf, size_t size, const char *format, ...); | |||
1469 | * @return number of bytes in "*buf" excluding 0-termination | 1475 | * @return number of bytes in "*buf" excluding 0-termination |
1470 | */ | 1476 | */ |
1471 | int | 1477 | int |
1472 | GNUNET_asprintf (char **buf, const char *format, ...); | 1478 | GNUNET_asprintf (char **buf, |
1479 | const char *format, | ||
1480 | ...) | ||
1481 | __attribute__ ((format (printf, 2, 3))); | ||
1473 | 1482 | ||
1474 | 1483 | ||
1475 | /* ************** internal implementations, use macros above! ************** */ | 1484 | /* ************** internal implementations, use macros above! ************** */ |
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h index 4566caad0..be5a81cfb 100644 --- a/src/include/gnunet_conversation_service.h +++ b/src/include/gnunet_conversation_service.h | |||
@@ -147,7 +147,7 @@ typedef void | |||
147 | struct GNUNET_CONVERSATION_Caller * | 147 | struct GNUNET_CONVERSATION_Caller * |
148 | caller, | 148 | caller, |
149 | const struct | 149 | const struct |
150 | GNUNET_CRYPTO_EcdsaPublicKey *caller_id); | 150 | GNUNET_IDENTITY_PublicKey *caller_id); |
151 | 151 | ||
152 | 152 | ||
153 | /** | 153 | /** |
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 03fb16a43..2bbf2b1e7 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -1700,7 +1700,7 @@ GNUNET_CRYPTO_eddsa_sign_ ( | |||
1700 | */ | 1700 | */ |
1701 | #define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \ | 1701 | #define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \ |
1702 | /* check size is set correctly */ \ | 1702 | /* check size is set correctly */ \ |
1703 | GNUNET_assert (htonl ((ps)->purpose.size) == sizeof (*ps)); \ | 1703 | GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)); \ |
1704 | /* check 'ps' begins with the purpose */ \ | 1704 | /* check 'ps' begins with the purpose */ \ |
1705 | GNUNET_static_assert (((void*) (ps)) == \ | 1705 | GNUNET_static_assert (((void*) (ps)) == \ |
1706 | ((void*) &(ps)->purpose)); \ | 1706 | ((void*) &(ps)->purpose)); \ |
@@ -1747,7 +1747,7 @@ GNUNET_CRYPTO_ecdsa_sign_ ( | |||
1747 | */ | 1747 | */ |
1748 | #define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \ | 1748 | #define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \ |
1749 | /* check size is set correctly */ \ | 1749 | /* check size is set correctly */ \ |
1750 | GNUNET_assert (htonl ((ps)->purpose.size) == sizeof (*(ps))); \ | 1750 | GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ |
1751 | /* check 'ps' begins with the purpose */ \ | 1751 | /* check 'ps' begins with the purpose */ \ |
1752 | GNUNET_static_assert (((void*) (ps)) == \ | 1752 | GNUNET_static_assert (((void*) (ps)) == \ |
1753 | ((void*) &(ps)->purpose)); \ | 1753 | ((void*) &(ps)->purpose)); \ |
@@ -1853,7 +1853,7 @@ GNUNET_CRYPTO_ecdsa_verify_ ( | |||
1853 | */ | 1853 | */ |
1854 | #define GNUNET_CRYPTO_ecdsa_verify(purp,ps,sig,pub) ({ \ | 1854 | #define GNUNET_CRYPTO_ecdsa_verify(purp,ps,sig,pub) ({ \ |
1855 | /* check size is set correctly */ \ | 1855 | /* check size is set correctly */ \ |
1856 | GNUNET_assert (htonl ((ps)->purpose.size) == sizeof (*(ps))); \ | 1856 | GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ |
1857 | /* check 'ps' begins with the purpose */ \ | 1857 | /* check 'ps' begins with the purpose */ \ |
1858 | GNUNET_static_assert (((void*) (ps)) == \ | 1858 | GNUNET_static_assert (((void*) (ps)) == \ |
1859 | ((void*) &(ps)->purpose)); \ | 1859 | ((void*) &(ps)->purpose)); \ |
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h index ef81e9a88..3f6c9b9aa 100644 --- a/src/include/gnunet_gns_service.h +++ b/src/include/gnunet_gns_service.h | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include "gnunet_util_lib.h" | 37 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_dnsparser_lib.h" | 38 | #include "gnunet_dnsparser_lib.h" |
39 | #include "gnunet_identity_service.h" | ||
39 | #include "gnunet_namestore_service.h" | 40 | #include "gnunet_namestore_service.h" |
40 | 41 | ||
41 | #ifdef __cplusplus | 42 | #ifdef __cplusplus |
@@ -139,7 +140,7 @@ enum GNUNET_GNS_LocalOptions | |||
139 | struct GNUNET_GNS_LookupRequest * | 140 | struct GNUNET_GNS_LookupRequest * |
140 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | 141 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, |
141 | const char *name, | 142 | const char *name, |
142 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 143 | const struct GNUNET_IDENTITY_PublicKey *zone, |
143 | uint32_t type, | 144 | uint32_t type, |
144 | enum GNUNET_GNS_LocalOptions options, | 145 | enum GNUNET_GNS_LocalOptions options, |
145 | GNUNET_GNS_LookupResultProcessor proc, | 146 | GNUNET_GNS_LookupResultProcessor proc, |
@@ -163,7 +164,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | |||
163 | struct GNUNET_GNS_LookupRequest * | 164 | struct GNUNET_GNS_LookupRequest * |
164 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, | 165 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, |
165 | const char *name, | 166 | const char *name, |
166 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 167 | const struct GNUNET_IDENTITY_PublicKey *zone, |
167 | uint32_t type, | 168 | uint32_t type, |
168 | enum GNUNET_GNS_LocalOptions options, | 169 | enum GNUNET_GNS_LocalOptions options, |
169 | uint16_t recursion_depth_limit, | 170 | uint16_t recursion_depth_limit, |
diff --git a/src/include/gnunet_gnsrecord_json_lib.h b/src/include/gnunet_gnsrecord_json_lib.h new file mode 100644 index 000000000..966461705 --- /dev/null +++ b/src/include/gnunet_gnsrecord_json_lib.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2012, 2013 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Martin Schanzenbach | ||
23 | * | ||
24 | * @file | ||
25 | * API that can be used to manipulate JSON GNS record data | ||
26 | * | ||
27 | * @defgroup gnsrecord GNS Record library | ||
28 | * Manipulate GNS record data | ||
29 | * | ||
30 | * @see [Documentation](https://gnunet.org/gns-plugins) | ||
31 | * | ||
32 | * @{ | ||
33 | */ | ||
34 | #ifndef GNUNET_GNSRECORD_JSON_LIB_H | ||
35 | #define GNUNET_GNSRECORD_JSON_LIB_H | ||
36 | |||
37 | #include "gnunet_gnsrecord_lib.h" | ||
38 | #include "gnunet_json_lib.h" | ||
39 | |||
40 | #ifdef __cplusplus | ||
41 | extern "C" { | ||
42 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
43 | } | ||
44 | #endif | ||
45 | #endif | ||
46 | |||
47 | |||
48 | /** | ||
49 | * JSON Specification for GNS Records. | ||
50 | * | ||
51 | * @param gnsrecord_object struct of GNUNET_GNSRECORD_Data to fill | ||
52 | * @return JSON Specification | ||
53 | */ | ||
54 | struct GNUNET_JSON_Specification | ||
55 | GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd, | ||
56 | unsigned int *rd_count, | ||
57 | char **name); | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Convert GNS record to JSON. | ||
62 | * | ||
63 | * @param rname name of record | ||
64 | * @param rd record data | ||
65 | * @return corresponding JSON encoding | ||
66 | */ | ||
67 | json_t * | ||
68 | GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname, | ||
69 | const struct GNUNET_GNSRECORD_Data *rd, | ||
70 | unsigned int rd_count); | ||
71 | |||
72 | |||
73 | #endif | ||
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 960203fb1..0bf2ceed7 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -34,6 +34,8 @@ | |||
34 | #ifndef GNUNET_GNSRECORD_LIB_H | 34 | #ifndef GNUNET_GNSRECORD_LIB_H |
35 | #define GNUNET_GNSRECORD_LIB_H | 35 | #define GNUNET_GNSRECORD_LIB_H |
36 | 36 | ||
37 | #include "gnunet_identity_service.h" | ||
38 | |||
37 | #ifdef __cplusplus | 39 | #ifdef __cplusplus |
38 | extern "C" { | 40 | extern "C" { |
39 | #if 0 /* keep Emacsens' auto-indent happy */ | 41 | #if 0 /* keep Emacsens' auto-indent happy */ |
@@ -55,7 +57,7 @@ extern "C" { | |||
55 | /** | 57 | /** |
56 | * Record type for GNS zone transfer ("PKEY"). | 58 | * Record type for GNS zone transfer ("PKEY"). |
57 | */ | 59 | */ |
58 | #define GNUNET_GNSRECORD_TYPE_PKEY 65536 | 60 | #define GNUNET_GNSRECORD_TYPE_PKEY GNUNET_IDENTITY_TYPE_ECDSA |
59 | 61 | ||
60 | /** | 62 | /** |
61 | * Record type for GNS nick names ("NICK"). | 63 | * Record type for GNS nick names ("NICK"). |
@@ -151,6 +153,11 @@ extern "C" { | |||
151 | */ | 153 | */ |
152 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 | 154 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 |
153 | 155 | ||
156 | /** | ||
157 | * Record type for EDKEY delegations. | ||
158 | */ | ||
159 | #define GNUNET_GNSRECORD_TYPE_EDKEY GNUNET_IDENTITY_TYPE_EDDSA | ||
160 | |||
154 | 161 | ||
155 | /** | 162 | /** |
156 | * Flags that can be set for a record. | 163 | * Flags that can be set for a record. |
@@ -261,21 +268,20 @@ struct GNUNET_GNSRECORD_PlaceData | |||
261 | /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */ | 268 | /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */ |
262 | }; | 269 | }; |
263 | 270 | ||
264 | |||
265 | /** | 271 | /** |
266 | * Information we have in an encrypted block with record data (i.e. in the DHT). | 272 | * Information we have in an encrypted block with record data (i.e. in the DHT). |
267 | */ | 273 | */ |
268 | struct GNUNET_GNSRECORD_Block | 274 | struct GNUNET_GNSRECORD_EcdsaBlock |
269 | { | 275 | { |
270 | /** | 276 | /** |
271 | * Signature of the block. | 277 | * Derived key used for signing; hash of this is the query. |
272 | */ | 278 | */ |
273 | struct GNUNET_CRYPTO_EcdsaSignature signature; | 279 | struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; |
274 | 280 | ||
275 | /** | 281 | /** |
276 | * Derived key used for signing; hash of this is the query. | 282 | * Signature of the block. |
277 | */ | 283 | */ |
278 | struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; | 284 | struct GNUNET_CRYPTO_EcdsaSignature signature; |
279 | 285 | ||
280 | /** | 286 | /** |
281 | * Number of bytes signed; also specifies the number of bytes | 287 | * Number of bytes signed; also specifies the number of bytes |
@@ -291,6 +297,17 @@ struct GNUNET_GNSRECORD_Block | |||
291 | /* followed by encrypted data */ | 297 | /* followed by encrypted data */ |
292 | }; | 298 | }; |
293 | 299 | ||
300 | struct GNUNET_GNSRECORD_Block | ||
301 | { | ||
302 | uint32_t type; | ||
303 | |||
304 | union | ||
305 | { | ||
306 | struct GNUNET_GNSRECORD_EcdsaBlock ecdsa_block; | ||
307 | //struct GNUNET_GNSRECORD_EddsaBlock eddsa_block; | ||
308 | }; | ||
309 | }; | ||
310 | |||
294 | 311 | ||
295 | /** | 312 | /** |
296 | * Record type used to box up SRV and TLSA records. For example, a | 313 | * Record type used to box up SRV and TLSA records. For example, a |
@@ -335,7 +352,7 @@ struct GNUNET_GNSRECORD_ReverseRecord | |||
335 | /** | 352 | /** |
336 | * The public key of the namespace the is delegating to our namespace | 353 | * The public key of the namespace the is delegating to our namespace |
337 | */ | 354 | */ |
338 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 355 | struct GNUNET_IDENTITY_PublicKey pkey; |
339 | 356 | ||
340 | /** | 357 | /** |
341 | * The expiration time of the delegation | 358 | * The expiration time of the delegation |
@@ -488,7 +505,7 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src); | |||
488 | * #GNUNET_GNSRECORD_z2s. | 505 | * #GNUNET_GNSRECORD_z2s. |
489 | */ | 506 | */ |
490 | const char * | 507 | const char * |
491 | GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); | 508 | GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z); |
492 | 509 | ||
493 | 510 | ||
494 | /** | 511 | /** |
@@ -502,7 +519,7 @@ GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); | |||
502 | * key in an encoding suitable for DNS labels. | 519 | * key in an encoding suitable for DNS labels. |
503 | */ | 520 | */ |
504 | const char * | 521 | const char * |
505 | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | 522 | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey); |
506 | 523 | ||
507 | 524 | ||
508 | /** | 525 | /** |
@@ -516,7 +533,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | |||
516 | */ | 533 | */ |
517 | int | 534 | int |
518 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | 535 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, |
519 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | 536 | struct GNUNET_IDENTITY_PublicKey *pkey); |
520 | 537 | ||
521 | 538 | ||
522 | /** | 539 | /** |
@@ -528,7 +545,7 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | |||
528 | */ | 545 | */ |
529 | void | 546 | void |
530 | GNUNET_GNSRECORD_query_from_private_key ( | 547 | GNUNET_GNSRECORD_query_from_private_key ( |
531 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, | 548 | const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, |
532 | struct GNUNET_HashCode *query); | 549 | struct GNUNET_HashCode *query); |
533 | 550 | ||
534 | 551 | ||
@@ -541,7 +558,7 @@ GNUNET_GNSRECORD_query_from_private_key ( | |||
541 | */ | 558 | */ |
542 | void | 559 | void |
543 | GNUNET_GNSRECORD_query_from_public_key ( | 560 | GNUNET_GNSRECORD_query_from_public_key ( |
544 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, | 561 | const struct GNUNET_IDENTITY_PublicKey *pub, const char *label, |
545 | struct GNUNET_HashCode *query); | 562 | struct GNUNET_HashCode *query); |
546 | 563 | ||
547 | 564 | ||
@@ -555,7 +572,7 @@ GNUNET_GNSRECORD_query_from_public_key ( | |||
555 | * @param rd_count number of records in @a rd | 572 | * @param rd_count number of records in @a rd |
556 | */ | 573 | */ |
557 | struct GNUNET_GNSRECORD_Block * | 574 | struct GNUNET_GNSRECORD_Block * |
558 | GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 575 | GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key, |
559 | struct GNUNET_TIME_Absolute expire, | 576 | struct GNUNET_TIME_Absolute expire, |
560 | const char *label, | 577 | const char *label, |
561 | const struct GNUNET_GNSRECORD_Data *rd, | 578 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -574,7 +591,7 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
574 | * @param rd_count number of records in @a rd | 591 | * @param rd_count number of records in @a rd |
575 | */ | 592 | */ |
576 | struct GNUNET_GNSRECORD_Block * | 593 | struct GNUNET_GNSRECORD_Block * |
577 | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 594 | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *key, |
578 | struct GNUNET_TIME_Absolute expire, | 595 | struct GNUNET_TIME_Absolute expire, |
579 | const char *label, | 596 | const char *label, |
580 | const struct GNUNET_GNSRECORD_Data *rd, | 597 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -606,7 +623,7 @@ GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block); | |||
606 | int | 623 | int |
607 | GNUNET_GNSRECORD_block_decrypt ( | 624 | GNUNET_GNSRECORD_block_decrypt ( |
608 | const struct GNUNET_GNSRECORD_Block *block, | 625 | const struct GNUNET_GNSRECORD_Block *block, |
609 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, | 626 | const struct GNUNET_IDENTITY_PublicKey *zone_key, const char *label, |
610 | GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); | 627 | GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); |
611 | 628 | ||
612 | 629 | ||
@@ -636,6 +653,82 @@ GNUNET_GNSRECORD_record_get_expiration_time ( | |||
636 | unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); | 653 | unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); |
637 | 654 | ||
638 | 655 | ||
656 | /** | ||
657 | * Returns the length of this block in bytes. | ||
658 | * Block length strongly depends on the zone type. | ||
659 | * | ||
660 | * @param block the block. | ||
661 | * @return the length of this block in bytes | ||
662 | */ | ||
663 | size_t | ||
664 | GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block); | ||
665 | |||
666 | /** | ||
667 | * Returns the expiration of a block. | ||
668 | * | ||
669 | * @param block the block. | ||
670 | * @return the block expiration. | ||
671 | */ | ||
672 | struct GNUNET_TIME_Absolute | ||
673 | GNUNET_GNSRECORD_block_get_expiration (const struct GNUNET_GNSRECORD_Block *block); | ||
674 | |||
675 | |||
676 | /** | ||
677 | * Builds the query hash from a block. | ||
678 | * | ||
679 | * @param block the block. | ||
680 | * @param query where to write the query hash. | ||
681 | * @return GNUNET_SYSERR on error. | ||
682 | */ | ||
683 | enum GNUNET_GenericReturnValue | ||
684 | GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block, | ||
685 | struct GNUNET_HashCode *query); | ||
686 | |||
687 | |||
688 | /** | ||
689 | * Build a #GNUNET_GNSRECORD_PublicKey from | ||
690 | * zone delegation resource record data. | ||
691 | * | ||
692 | * @param data the record data- | ||
693 | * @param data_size the data size. | ||
694 | * @param type the record type | ||
695 | * @param key the identity key to store the data in (must be allocated). | ||
696 | * @return GNUNET_OK if successful. | ||
697 | */ | ||
698 | enum GNUNET_GenericReturnValue | ||
699 | GNUNET_GNSRECORD_identity_from_data (const char *data, | ||
700 | size_t data_size, | ||
701 | uint32_t type, | ||
702 | struct GNUNET_IDENTITY_PublicKey *key); | ||
703 | |||
704 | |||
705 | /** | ||
706 | * Create record data and size from an identity key. | ||
707 | * | ||
708 | * @param key the identity key to use. | ||
709 | * @param data the record data (will be allocated) | ||
710 | * @param data_size the allocated data size. | ||
711 | * @param type the resulting record type | ||
712 | * @return GNUNET_OK if successful. | ||
713 | */ | ||
714 | enum GNUNET_GenericReturnValue | ||
715 | GNUNET_GNSRECORD_data_from_identity (const struct GNUNET_IDENTITY_PublicKey *key, | ||
716 | char **data, | ||
717 | size_t *data_size, | ||
718 | uint32_t *type); | ||
719 | |||
720 | |||
721 | /** | ||
722 | * Check if this type is one of the supported GNS zone | ||
723 | * types. | ||
724 | * | ||
725 | * @param type the type to check | ||
726 | * @return GNUNET_YES if it is one of the supported types. | ||
727 | */ | ||
728 | enum GNUNET_GenericReturnValue | ||
729 | GNUNET_GNSRECORD_is_zonekey_type (uint32_t type); | ||
730 | |||
731 | |||
639 | #if 0 /* keep Emacsens' auto-indent happy */ | 732 | #if 0 /* keep Emacsens' auto-indent happy */ |
640 | { | 733 | { |
641 | #endif | 734 | #endif |
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index 94127248e..2974568db 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -57,6 +57,21 @@ extern "C" { | |||
57 | */ | 57 | */ |
58 | #define GNUNET_IDENTITY_VERSION 0x00000100 | 58 | #define GNUNET_IDENTITY_VERSION 0x00000100 |
59 | 59 | ||
60 | enum GNUNET_IDENTITY_KeyType | ||
61 | { | ||
62 | /** | ||
63 | * The identity type. The value is the same as the | ||
64 | * PKEY record type. | ||
65 | */ | ||
66 | GNUNET_IDENTITY_TYPE_ECDSA = 65536, | ||
67 | |||
68 | /** | ||
69 | * EDDSA identity. The value is the same as the EDKEY | ||
70 | * record type. | ||
71 | */ | ||
72 | GNUNET_IDENTITY_TYPE_EDDSA = 65556 | ||
73 | }; | ||
74 | |||
60 | /** | 75 | /** |
61 | * Handle to access the identity service. | 76 | * Handle to access the identity service. |
62 | */ | 77 | */ |
@@ -67,6 +82,88 @@ struct GNUNET_IDENTITY_Handle; | |||
67 | */ | 82 | */ |
68 | struct GNUNET_IDENTITY_Ego; | 83 | struct GNUNET_IDENTITY_Ego; |
69 | 84 | ||
85 | |||
86 | /** | ||
87 | * A private key for an identity as per LSD0001. | ||
88 | */ | ||
89 | struct GNUNET_IDENTITY_PrivateKey | ||
90 | { | ||
91 | /** | ||
92 | * Type of public key. | ||
93 | * Defined by the GNS zone type value. | ||
94 | * In NBO. | ||
95 | */ | ||
96 | uint32_t type; | ||
97 | |||
98 | union | ||
99 | { | ||
100 | /** | ||
101 | * An ECDSA identity key. | ||
102 | */ | ||
103 | struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key; | ||
104 | |||
105 | /** | ||
106 | * AN EdDSA identtiy key | ||
107 | */ | ||
108 | struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key; | ||
109 | }; | ||
110 | }; | ||
111 | |||
112 | |||
113 | /** | ||
114 | * An identity key as per LSD0001. | ||
115 | */ | ||
116 | struct GNUNET_IDENTITY_PublicKey | ||
117 | { | ||
118 | /** | ||
119 | * Type of public key. | ||
120 | * Defined by the GNS zone type value. | ||
121 | * In NBO. | ||
122 | */ | ||
123 | uint32_t type; | ||
124 | |||
125 | union | ||
126 | { | ||
127 | /** | ||
128 | * An ECDSA identity key. | ||
129 | */ | ||
130 | struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key; | ||
131 | |||
132 | /** | ||
133 | * AN EdDSA identtiy key | ||
134 | */ | ||
135 | struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key; | ||
136 | }; | ||
137 | }; | ||
138 | |||
139 | |||
140 | /** | ||
141 | * An identity signature as per LSD0001. | ||
142 | */ | ||
143 | struct GNUNET_IDENTITY_Signature | ||
144 | { | ||
145 | /** | ||
146 | * Type of signature. | ||
147 | * Defined by the GNS zone type value. | ||
148 | * In NBO. | ||
149 | */ | ||
150 | uint32_t type; | ||
151 | |||
152 | union | ||
153 | { | ||
154 | /** | ||
155 | * An ECDSA signature | ||
156 | */ | ||
157 | struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature; | ||
158 | |||
159 | /** | ||
160 | * AN EdDSA signature | ||
161 | */ | ||
162 | struct GNUNET_CRYPTO_EddsaSignature eddsa_signature; | ||
163 | }; | ||
164 | }; | ||
165 | |||
166 | |||
70 | /** | 167 | /** |
71 | * Handle for an operation with the identity service. | 168 | * Handle for an operation with the identity service. |
72 | */ | 169 | */ |
@@ -79,7 +176,7 @@ struct GNUNET_IDENTITY_Operation; | |||
79 | * @param ego the ego | 176 | * @param ego the ego |
80 | * @return associated ECC key, valid as long as the ego is valid | 177 | * @return associated ECC key, valid as long as the ego is valid |
81 | */ | 178 | */ |
82 | const struct GNUNET_CRYPTO_EcdsaPrivateKey * | 179 | const struct GNUNET_IDENTITY_PrivateKey * |
83 | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); | 180 | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); |
84 | 181 | ||
85 | 182 | ||
@@ -100,7 +197,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void); | |||
100 | */ | 197 | */ |
101 | void | 198 | void |
102 | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, | 199 | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, |
103 | struct GNUNET_CRYPTO_EcdsaPublicKey *pk); | 200 | struct GNUNET_IDENTITY_PublicKey *pk); |
104 | 201 | ||
105 | 202 | ||
106 | /** | 203 | /** |
@@ -224,7 +321,7 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h); | |||
224 | typedef void | 321 | typedef void |
225 | (*GNUNET_IDENTITY_CreateContinuation) ( | 322 | (*GNUNET_IDENTITY_CreateContinuation) ( |
226 | void *cls, | 323 | void *cls, |
227 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 324 | const struct GNUNET_IDENTITY_PrivateKey *pk, |
228 | const char *emsg); | 325 | const char *emsg); |
229 | 326 | ||
230 | 327 | ||
@@ -234,6 +331,7 @@ typedef void | |||
234 | * @param id identity service to use | 331 | * @param id identity service to use |
235 | * @param name desired name | 332 | * @param name desired name |
236 | * @param privkey desired private key or NULL to create one | 333 | * @param privkey desired private key or NULL to create one |
334 | * @param ktype the type of key to create. Ignored if privkey != NULL. | ||
237 | * @param cont function to call with the result (will only be called once) | 335 | * @param cont function to call with the result (will only be called once) |
238 | * @param cont_cls closure for @a cont | 336 | * @param cont_cls closure for @a cont |
239 | * @return handle to abort the operation | 337 | * @return handle to abort the operation |
@@ -241,7 +339,8 @@ typedef void | |||
241 | struct GNUNET_IDENTITY_Operation * | 339 | struct GNUNET_IDENTITY_Operation * |
242 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, | 340 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, |
243 | const char *name, | 341 | const char *name, |
244 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey, | 342 | const struct GNUNET_IDENTITY_PrivateKey *privkey, |
343 | enum GNUNET_IDENTITY_KeyType ktype, | ||
245 | GNUNET_IDENTITY_CreateContinuation cont, | 344 | GNUNET_IDENTITY_CreateContinuation cont, |
246 | void *cont_cls); | 345 | void *cont_cls); |
247 | 346 | ||
@@ -292,6 +391,319 @@ void | |||
292 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); | 391 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); |
293 | 392 | ||
294 | 393 | ||
394 | /** | ||
395 | * Get the compacted length of a #GNUNET_IDENTITY_PublicKey. | ||
396 | * Compacted means that it returns the minimum number of bytes this | ||
397 | * key is long, as opposed to the union structure inside | ||
398 | * #GNUNET_IDENTITY_PublicKey. | ||
399 | * Useful for compact serializations. | ||
400 | * | ||
401 | * @param key the key. | ||
402 | * @return -1 on error, else the compacted length of the key. | ||
403 | */ | ||
404 | ssize_t | ||
405 | GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key); | ||
406 | |||
407 | |||
408 | /** | ||
409 | * Reads a #GNUNET_IDENTITY_PublicKey from a compact buffer. | ||
410 | * The buffer has to contain at least the compacted length of | ||
411 | * a #GNUNET_IDENTITY_PublicKey in bytes. | ||
412 | * If the buffer is too small, the function returns -1 as error. | ||
413 | * If the buffer does not contain a valid key, it returns -2 as error. | ||
414 | * | ||
415 | * @param key the key | ||
416 | * @param buffer the buffer | ||
417 | * @param len the length of buffer | ||
418 | * @return -1 or -2 on error, else the amount of bytes read from the buffer | ||
419 | */ | ||
420 | ssize_t | ||
421 | GNUNET_IDENTITY_read_key_from_buffer (struct GNUNET_IDENTITY_PublicKey *key, | ||
422 | const void*buffer, | ||
423 | size_t len); | ||
424 | |||
425 | |||
426 | /** | ||
427 | * Writes a #GNUNET_IDENTITY_PublicKey to a compact buffer. | ||
428 | * The buffer requires space for at least the compacted length of | ||
429 | * a #GNUNET_IDENTITY_PublicKey in bytes. | ||
430 | * If the buffer is too small, the function returns -1 as error. | ||
431 | * If the key is not valid, it returns -2 as error. | ||
432 | * | ||
433 | * @param key the key | ||
434 | * @param buffer the buffer | ||
435 | * @param len the length of buffer | ||
436 | * @return -1 or -2 on error, else the amount of bytes written to the buffer | ||
437 | */ | ||
438 | ssize_t | ||
439 | GNUNET_IDENTITY_write_key_to_buffer (const struct | ||
440 | GNUNET_IDENTITY_PublicKey *key, | ||
441 | void*buffer, | ||
442 | size_t len); | ||
443 | |||
444 | |||
445 | /** | ||
446 | * Get the compacted length of a #GNUNET_IDENTITY_Signature. | ||
447 | * Compacted means that it returns the minimum number of bytes this | ||
448 | * signature is long, as opposed to the union structure inside | ||
449 | * #GNUNET_IDENTITY_Signature. | ||
450 | * Useful for compact serializations. | ||
451 | * | ||
452 | * @param sig the signature. | ||
453 | * @return -1 on error, else the compacted length of the signature. | ||
454 | */ | ||
455 | ssize_t | ||
456 | GNUNET_IDENTITY_signature_get_length (const struct | ||
457 | GNUNET_IDENTITY_Signature *sig); | ||
458 | |||
459 | |||
460 | /** | ||
461 | * Reads a #GNUNET_IDENTITY_Signature from a compact buffer. | ||
462 | * The buffer has to contain at least the compacted length of | ||
463 | * a #GNUNET_IDENTITY_Signature in bytes. | ||
464 | * If the buffer is too small, the function returns -1 as error. | ||
465 | * If the buffer does not contain a valid key, it returns -2 as error. | ||
466 | * | ||
467 | * @param sig the signature | ||
468 | * @param buffer the buffer | ||
469 | * @param len the length of buffer | ||
470 | * @return -1 or -2 on error, else the amount of bytes read from the buffer | ||
471 | */ | ||
472 | ssize_t | ||
473 | GNUNET_IDENTITY_read_signature_from_buffer (struct | ||
474 | GNUNET_IDENTITY_Signature *sig, | ||
475 | const void*buffer, | ||
476 | size_t len); | ||
477 | |||
478 | |||
479 | /** | ||
480 | * Writes a #GNUNET_IDENTITY_Signature to a compact buffer. | ||
481 | * The buffer requires space for at least the compacted length of | ||
482 | * a #GNUNET_IDENTITY_Signature in bytes. | ||
483 | * If the buffer is too small, the function returns -1 as error. | ||
484 | * If the key is not valid, it returns -2 as error. | ||
485 | * | ||
486 | * @param sig the signature | ||
487 | * @param buffer the buffer | ||
488 | * @param len the length of buffer | ||
489 | * @return -1 or -2 on error, else the amount of bytes written to the buffer | ||
490 | */ | ||
491 | ssize_t | ||
492 | GNUNET_IDENTITY_write_signature_to_buffer (const struct | ||
493 | GNUNET_IDENTITY_Signature *sig, | ||
494 | void*buffer, | ||
495 | size_t len); | ||
496 | |||
497 | |||
498 | /** | ||
499 | * @brief Sign a given block. | ||
500 | * | ||
501 | * The @a purpose data is the beginning of the data of which the signature is | ||
502 | * to be created. The `size` field in @a purpose must correctly indicate the | ||
503 | * number of bytes of the data structure, including its header. If possible, | ||
504 | * use #GNUNET_IDENTITY_sign() instead of this function. | ||
505 | * | ||
506 | * @param priv private key to use for the signing | ||
507 | * @param purpose what to sign (size, purpose) | ||
508 | * @param[out] sig where to write the signature | ||
509 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | ||
510 | */ | ||
511 | int | ||
512 | GNUNET_IDENTITY_sign_ (const struct | ||
513 | GNUNET_IDENTITY_PrivateKey *priv, | ||
514 | const struct | ||
515 | GNUNET_CRYPTO_EccSignaturePurpose *purpose, | ||
516 | struct GNUNET_IDENTITY_Signature *sig); | ||
517 | |||
518 | |||
519 | /** | ||
520 | * @brief Sign a given block with #GNUNET_IDENTITY_PrivateKey. | ||
521 | * | ||
522 | * The @a ps data must be a fixed-size struct for which the signature is to be | ||
523 | * created. The `size` field in @a ps->purpose must correctly indicate the | ||
524 | * number of bytes of the data structure, including its header. | ||
525 | * | ||
526 | * @param priv private key to use for the signing | ||
527 | * @param ps packed struct with what to sign, MUST begin with a purpose | ||
528 | * @param[out] sig where to write the signature | ||
529 | */ | ||
530 | #define GNUNET_IDENTITY_sign(priv,ps,sig) do { \ | ||
531 | /* check size is set correctly */ \ | ||
532 | GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ | ||
533 | /* check 'ps' begins with the purpose */ \ | ||
534 | GNUNET_static_assert (((void*) (ps)) == \ | ||
535 | ((void*) &(ps)->purpose)); \ | ||
536 | GNUNET_assert (GNUNET_OK == \ | ||
537 | GNUNET_IDENTITY_sign_ (priv, \ | ||
538 | &(ps)->purpose, \ | ||
539 | sig)); \ | ||
540 | } while (0) | ||
541 | |||
542 | |||
543 | /** | ||
544 | * @brief Verify a given signature. | ||
545 | * | ||
546 | * The @a validate data is the beginning of the data of which the signature | ||
547 | * is to be verified. The `size` field in @a validate must correctly indicate | ||
548 | * the number of bytes of the data structure, including its header. If @a | ||
549 | * purpose does not match the purpose given in @a validate (the latter must be | ||
550 | * in big endian), signature verification fails. If possible, | ||
551 | * use #GNUNET_IDENTITY_signature_verify() instead of this function (only if @a validate | ||
552 | * is not fixed-size, you must use this function directly). | ||
553 | * | ||
554 | * @param purpose what is the purpose that the signature should have? | ||
555 | * @param validate block to validate (size, purpose, data) | ||
556 | * @param sig signature that is being validated | ||
557 | * @param pub public key of the signer | ||
558 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid | ||
559 | */ | ||
560 | int | ||
561 | GNUNET_IDENTITY_signature_verify_ (uint32_t purpose, | ||
562 | const struct | ||
563 | GNUNET_CRYPTO_EccSignaturePurpose *validate, | ||
564 | const struct GNUNET_IDENTITY_Signature *sig, | ||
565 | const struct | ||
566 | GNUNET_IDENTITY_PublicKey *pub); | ||
567 | |||
568 | |||
569 | /** | ||
570 | * @brief Verify a given signature with #GNUNET_IDENTITY_PublicKey. | ||
571 | * | ||
572 | * The @a ps data must be a fixed-size struct for which the signature is to be | ||
573 | * created. The `size` field in @a ps->purpose must correctly indicate the | ||
574 | * number of bytes of the data structure, including its header. | ||
575 | * | ||
576 | * @param purp purpose of the signature, must match 'ps->purpose.purpose' | ||
577 | * (except in host byte order) | ||
578 | * @param ps packed struct with what to sign, MUST begin with a purpose | ||
579 | * @param sig where to read the signature from | ||
580 | * @param pub public key to use for the verifying | ||
581 | */ | ||
582 | #define GNUNET_IDENTITY_signature_verify(purp,ps,sig,pub) ({ \ | ||
583 | /* check size is set correctly */ \ | ||
584 | GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ | ||
585 | /* check 'ps' begins with the purpose */ \ | ||
586 | GNUNET_static_assert (((void*) (ps)) == \ | ||
587 | ((void*) &(ps)->purpose)); \ | ||
588 | GNUNET_IDENTITY_signature_verify_ (purp, \ | ||
589 | &(ps)->purpose, \ | ||
590 | sig, \ | ||
591 | pub); \ | ||
592 | }) | ||
593 | |||
594 | |||
595 | /** | ||
596 | * Encrypt a block with #GNUNET_IDENTITY_PublicKey and derives a | ||
597 | * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption | ||
598 | * using ecdh to derive a symmetric key. | ||
599 | * | ||
600 | * @param block the block to encrypt | ||
601 | * @param size the size of the @a block | ||
602 | * @param pub public key to use for ecdh | ||
603 | * @param ecc where to write the ecc public key | ||
604 | * @param result the output parameter in which to store the encrypted result | ||
605 | * can be the same or overlap with @c block | ||
606 | * @returns the size of the encrypted block, -1 for errors. | ||
607 | * Due to the use of CFB and therefore an effective stream cipher, | ||
608 | * this size should be the same as @c len. | ||
609 | */ | ||
610 | ssize_t | ||
611 | GNUNET_IDENTITY_encrypt (const void *block, | ||
612 | size_t size, | ||
613 | const struct GNUNET_IDENTITY_PublicKey *pub, | ||
614 | struct GNUNET_CRYPTO_EcdhePublicKey *ecc, | ||
615 | void *result); | ||
616 | |||
617 | |||
618 | /** | ||
619 | * Decrypt a given block with #GNUNET_IDENTITY_PrivateKey and a given | ||
620 | * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key. | ||
621 | * | ||
622 | * @param block the data to decrypt, encoded as returned by encrypt | ||
623 | * @param size the size of the @a block to decrypt | ||
624 | * @param priv private key to use for ecdh | ||
625 | * @param ecc the ecc public key | ||
626 | * @param result address to store the result at | ||
627 | * can be the same or overlap with @c block | ||
628 | * @return -1 on failure, size of decrypted block on success. | ||
629 | * Due to the use of CFB and therefore an effective stream cipher, | ||
630 | * this size should be the same as @c size. | ||
631 | */ | ||
632 | ssize_t | ||
633 | GNUNET_IDENTITY_decrypt (const void *block, | ||
634 | size_t size, | ||
635 | const struct | ||
636 | GNUNET_IDENTITY_PrivateKey *priv, | ||
637 | const struct | ||
638 | GNUNET_CRYPTO_EcdhePublicKey *ecc, | ||
639 | void *result); | ||
640 | |||
641 | |||
642 | /** | ||
643 | * Creates a (Base32) string representation of the public key. | ||
644 | * The resulting string encodes a compacted representation of the key. | ||
645 | * See also #GNUNET_IDENTITY_key_get_length. | ||
646 | * | ||
647 | * @param key the key. | ||
648 | * @return the string representation of the key, or NULL on error. | ||
649 | */ | ||
650 | char * | ||
651 | GNUNET_IDENTITY_public_key_to_string (const struct | ||
652 | GNUNET_IDENTITY_PublicKey *key); | ||
653 | |||
654 | |||
655 | /** | ||
656 | * Creates a (Base32) string representation of the private key. | ||
657 | * The resulting string encodes a compacted representation of the key. | ||
658 | * See also #GNUNET_IDENTITY_key_get_length. | ||
659 | * | ||
660 | * @param key the key. | ||
661 | * @return the string representation of the key, or NULL on error. | ||
662 | */ | ||
663 | char * | ||
664 | GNUNET_IDENTITY_private_key_to_string (const struct | ||
665 | GNUNET_IDENTITY_PrivateKey *key); | ||
666 | |||
667 | |||
668 | /** | ||
669 | * Parses a (Base32) string representation of the public key. | ||
670 | * See also #GNUNET_IDENTITY_public_key_to_string. | ||
671 | * | ||
672 | * @param str the encoded key. | ||
673 | * @param key where to write the key. | ||
674 | * @return GNUNET_SYSERR on error. | ||
675 | */ | ||
676 | enum GNUNET_GenericReturnValue | ||
677 | GNUNET_IDENTITY_public_key_from_string (const char*str, | ||
678 | struct GNUNET_IDENTITY_PublicKey *key); | ||
679 | |||
680 | |||
681 | /** | ||
682 | * Parses a (Base32) string representation of the private key. | ||
683 | * See also #GNUNET_IDENTITY_private_key_to_string. | ||
684 | * | ||
685 | * @param str the encoded key. | ||
686 | * @param key where to write the key. | ||
687 | * @return GNUNET_SYSERR on error. | ||
688 | */ | ||
689 | enum GNUNET_GenericReturnValue | ||
690 | GNUNET_IDENTITY_private_key_from_string (const char*str, | ||
691 | struct GNUNET_IDENTITY_PrivateKey *key); | ||
692 | |||
693 | |||
694 | /** | ||
695 | * Retrieves the public key representation of a private key. | ||
696 | * | ||
697 | * @param privkey the private key. | ||
698 | * @param key the public key result. | ||
699 | * @return GNUNET_SYSERR on error. | ||
700 | */ | ||
701 | enum GNUNET_GenericReturnValue | ||
702 | GNUNET_IDENTITY_key_get_public (const struct | ||
703 | GNUNET_IDENTITY_PrivateKey *privkey, | ||
704 | struct GNUNET_IDENTITY_PublicKey *key); | ||
705 | |||
706 | |||
295 | /* ************* convenience API to lookup an ego ***************** */ | 707 | /* ************* convenience API to lookup an ego ***************** */ |
296 | 708 | ||
297 | /** | 709 | /** |
@@ -344,7 +756,7 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el); | |||
344 | typedef void | 756 | typedef void |
345 | (*GNUNET_IDENTITY_EgoSuffixCallback) ( | 757 | (*GNUNET_IDENTITY_EgoSuffixCallback) ( |
346 | void *cls, | 758 | void *cls, |
347 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 759 | const struct GNUNET_IDENTITY_PrivateKey *priv, |
348 | const char *ego_name); | 760 | const char *ego_name); |
349 | 761 | ||
350 | 762 | ||
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 07a14d329..3dc79105e 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2014, 2015, 2016 GNUnet e.V. | 3 | Copyright (C) 2014, 2015, 2016, 2020 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 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 | 6 | under the terms of the GNU Affero General Public License as published |
@@ -28,7 +28,6 @@ | |||
28 | #define GNUNET_JSON_LIB_H | 28 | #define GNUNET_JSON_LIB_H |
29 | 29 | ||
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_gnsrecord_lib.h" | ||
32 | #include <jansson.h> | 31 | #include <jansson.h> |
33 | #include <microhttpd.h> | 32 | #include <microhttpd.h> |
34 | 33 | ||
@@ -359,18 +358,6 @@ GNUNET_JSON_spec_rsa_signature (const char *name, | |||
359 | struct GNUNET_CRYPTO_RsaSignature **sig); | 358 | struct GNUNET_CRYPTO_RsaSignature **sig); |
360 | 359 | ||
361 | 360 | ||
362 | /** | ||
363 | * JSON Specification for GNS Records. | ||
364 | * | ||
365 | * @param gnsrecord_object struct of GNUNET_GNSRECORD_Data to fill | ||
366 | * @return JSON Specification | ||
367 | */ | ||
368 | struct GNUNET_JSON_Specification | ||
369 | GNUNET_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd, | ||
370 | unsigned int *rd_count, | ||
371 | char **name); | ||
372 | |||
373 | |||
374 | /* ****************** Generic generator interface ******************* */ | 361 | /* ****************** Generic generator interface ******************* */ |
375 | 362 | ||
376 | 363 | ||
@@ -446,18 +433,6 @@ GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk); | |||
446 | json_t * | 433 | json_t * |
447 | GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig); | 434 | GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig); |
448 | 435 | ||
449 | /** | ||
450 | * Convert Gns record to JSON. | ||
451 | * | ||
452 | * @param rname name of record | ||
453 | * @param rd record data | ||
454 | * @return corresponding JSON encoding | ||
455 | */ | ||
456 | json_t * | ||
457 | GNUNET_JSON_from_gnsrecord (const char *rname, | ||
458 | const struct GNUNET_GNSRECORD_Data *rd, | ||
459 | unsigned int rd_count); | ||
460 | |||
461 | /* ******************* Helpers for MHD upload handling ******************* */ | 436 | /* ******************* Helpers for MHD upload handling ******************* */ |
462 | 437 | ||
463 | /** | 438 | /** |
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h new file mode 100644 index 000000000..8f5315c30 --- /dev/null +++ b/src/include/gnunet_messenger_service.h | |||
@@ -0,0 +1,436 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 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 Tobias Frisch | ||
22 | * | ||
23 | * @file | ||
24 | * MESSENGER service; manages decentralized chat groups | ||
25 | * | ||
26 | * @defgroup messenger MESSENGER service | ||
27 | * Instant messaging based on the CADET subsystem | ||
28 | * | ||
29 | * @{ | ||
30 | */ | ||
31 | |||
32 | #ifndef GNUNET_MESSENGER_SERVICE_H | ||
33 | #define GNUNET_MESSENGER_SERVICE_H | ||
34 | |||
35 | #ifdef __cplusplus | ||
36 | extern "C" { | ||
37 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
38 | } | ||
39 | #endif | ||
40 | #endif | ||
41 | |||
42 | #include "platform.h" | ||
43 | #include "gnunet_configuration_lib.h" | ||
44 | #include "gnunet_crypto_lib.h" | ||
45 | #include "gnunet_identity_service.h" | ||
46 | #include "gnunet_mq_lib.h" | ||
47 | #include "gnunet_protocols.h" | ||
48 | #include "gnunet_scheduler_lib.h" | ||
49 | #include "gnunet_time_lib.h" | ||
50 | |||
51 | #define GNUNET_MESSENGER_SERVICE_NAME "messenger" | ||
52 | |||
53 | /** | ||
54 | * Opaque handle to the messenger | ||
55 | */ | ||
56 | struct GNUNET_MESSENGER_Handle; | ||
57 | |||
58 | /** | ||
59 | * Opaque handle to a room | ||
60 | */ | ||
61 | struct GNUNET_MESSENGER_Room; | ||
62 | |||
63 | /** | ||
64 | * Opaque handle to a contact | ||
65 | */ | ||
66 | struct GNUNET_MESSENGER_Contact; | ||
67 | |||
68 | /** | ||
69 | * Enum for the different supported kinds of messages | ||
70 | */ | ||
71 | enum GNUNET_MESSENGER_MessageKind | ||
72 | { | ||
73 | GNUNET_MESSENGER_KIND_INFO = 1, | ||
74 | |||
75 | GNUNET_MESSENGER_KIND_JOIN = 2, | ||
76 | GNUNET_MESSENGER_KIND_LEAVE = 3, | ||
77 | |||
78 | GNUNET_MESSENGER_KIND_NAME = 4, | ||
79 | GNUNET_MESSENGER_KIND_KEY = 5, | ||
80 | GNUNET_MESSENGER_KIND_PEER = 6, | ||
81 | GNUNET_MESSENGER_KIND_ID = 7, | ||
82 | |||
83 | GNUNET_MESSENGER_KIND_MISS = 8, | ||
84 | GNUNET_MESSENGER_KIND_MERGE = 9, | ||
85 | GNUNET_MESSENGER_KIND_REQUEST = 10, | ||
86 | |||
87 | GNUNET_MESSENGER_KIND_INVITE = 11, | ||
88 | GNUNET_MESSENGER_KIND_TEXT = 12, | ||
89 | GNUNET_MESSENGER_KIND_FILE = 13, | ||
90 | |||
91 | GNUNET_MESSENGER_KIND_PRIVATE = 14, | ||
92 | |||
93 | GNUNET_MESSENGER_KIND_UNKNOWN = 0 | ||
94 | }__attribute__((__packed__)); | ||
95 | |||
96 | /** | ||
97 | * Get the name of a message <i>kind</i>. | ||
98 | * | ||
99 | * @param kind Kind of a message | ||
100 | * @return Name of that kind | ||
101 | */ | ||
102 | const char* | ||
103 | GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind); | ||
104 | |||
105 | struct GNUNET_MESSENGER_MessageHeader | ||
106 | { | ||
107 | struct GNUNET_IDENTITY_Signature signature; | ||
108 | |||
109 | struct GNUNET_TIME_AbsoluteNBO timestamp; | ||
110 | |||
111 | struct GNUNET_ShortHashCode sender_id; | ||
112 | struct GNUNET_HashCode previous; | ||
113 | |||
114 | enum GNUNET_MESSENGER_MessageKind kind; | ||
115 | }; | ||
116 | |||
117 | struct GNUNET_MESSENGER_MessageInfo | ||
118 | { | ||
119 | struct GNUNET_IDENTITY_PublicKey host_key; | ||
120 | struct GNUNET_ShortHashCode unique_id; | ||
121 | }; | ||
122 | |||
123 | struct GNUNET_MESSENGER_MessageJoin | ||
124 | { | ||
125 | struct GNUNET_IDENTITY_PublicKey key; | ||
126 | }; | ||
127 | |||
128 | struct GNUNET_MESSENGER_MessageLeave | ||
129 | { | ||
130 | }; | ||
131 | |||
132 | struct GNUNET_MESSENGER_MessageName | ||
133 | { | ||
134 | char *name; | ||
135 | }; | ||
136 | |||
137 | struct GNUNET_MESSENGER_MessageKey | ||
138 | { | ||
139 | struct GNUNET_IDENTITY_PublicKey key; | ||
140 | }; | ||
141 | |||
142 | struct GNUNET_MESSENGER_MessagePeer | ||
143 | { | ||
144 | struct GNUNET_PeerIdentity peer; | ||
145 | }; | ||
146 | |||
147 | struct GNUNET_MESSENGER_MessageId | ||
148 | { | ||
149 | struct GNUNET_ShortHashCode id; | ||
150 | }; | ||
151 | |||
152 | struct GNUNET_MESSENGER_MessageMiss | ||
153 | { | ||
154 | struct GNUNET_PeerIdentity peer; | ||
155 | }; | ||
156 | |||
157 | struct GNUNET_MESSENGER_MessageMerge | ||
158 | { | ||
159 | struct GNUNET_HashCode previous; | ||
160 | }; | ||
161 | |||
162 | struct GNUNET_MESSENGER_MessageRequest | ||
163 | { | ||
164 | struct GNUNET_HashCode hash; | ||
165 | }; | ||
166 | |||
167 | struct GNUNET_MESSENGER_MessageInvite | ||
168 | { | ||
169 | struct GNUNET_PeerIdentity door; | ||
170 | struct GNUNET_HashCode key; | ||
171 | }; | ||
172 | |||
173 | struct GNUNET_MESSENGER_MessageText | ||
174 | { | ||
175 | char *text; | ||
176 | }; | ||
177 | |||
178 | struct GNUNET_MESSENGER_MessageFile | ||
179 | { | ||
180 | struct GNUNET_CRYPTO_SymmetricSessionKey key; | ||
181 | struct GNUNET_HashCode hash; | ||
182 | char name[NAME_MAX]; | ||
183 | char *uri; | ||
184 | }; | ||
185 | |||
186 | struct GNUNET_MESSENGER_MessagePrivate | ||
187 | { | ||
188 | struct GNUNET_CRYPTO_EcdhePublicKey key; | ||
189 | |||
190 | uint16_t length; | ||
191 | char *data; | ||
192 | }; | ||
193 | |||
194 | struct GNUNET_MESSENGER_MessageBody | ||
195 | { | ||
196 | union | ||
197 | { | ||
198 | struct GNUNET_MESSENGER_MessageInfo info; | ||
199 | |||
200 | struct GNUNET_MESSENGER_MessageJoin join; | ||
201 | struct GNUNET_MESSENGER_MessageLeave leave; | ||
202 | |||
203 | struct GNUNET_MESSENGER_MessageName name; | ||
204 | struct GNUNET_MESSENGER_MessageKey key; | ||
205 | struct GNUNET_MESSENGER_MessagePeer peer; | ||
206 | struct GNUNET_MESSENGER_MessageId id; | ||
207 | |||
208 | struct GNUNET_MESSENGER_MessageMiss miss; | ||
209 | struct GNUNET_MESSENGER_MessageMerge merge; | ||
210 | struct GNUNET_MESSENGER_MessageRequest request; | ||
211 | |||
212 | struct GNUNET_MESSENGER_MessageInvite invite; | ||
213 | struct GNUNET_MESSENGER_MessageText text; | ||
214 | struct GNUNET_MESSENGER_MessageFile file; | ||
215 | |||
216 | struct GNUNET_MESSENGER_MessagePrivate private; | ||
217 | }; | ||
218 | }; | ||
219 | |||
220 | /** | ||
221 | * Struct to a message | ||
222 | */ | ||
223 | struct GNUNET_MESSENGER_Message | ||
224 | { | ||
225 | struct GNUNET_MESSENGER_MessageHeader header; | ||
226 | struct GNUNET_MESSENGER_MessageBody body; | ||
227 | }; | ||
228 | |||
229 | /** | ||
230 | * Method called whenever the EGO of a <i>handle</i> changes or if the first connection fails | ||
231 | * to load a valid EGO and the anonymous keypair will be used instead. | ||
232 | * | ||
233 | * @param cls Closure from <i>GNUNET_MESSENGER_connect</i> | ||
234 | * @param handle Messenger handle | ||
235 | */ | ||
236 | typedef void | ||
237 | (*GNUNET_MESSENGER_IdentityCallback) (void *cls, struct GNUNET_MESSENGER_Handle *handle); | ||
238 | |||
239 | /** | ||
240 | * Method called whenever a message is sent or received from a <i>room</i>. | ||
241 | * | ||
242 | * @param cls Closure from <i>GNUNET_MESSENGER_connect</i> | ||
243 | * @param room Room handle | ||
244 | * @param message Newly received or sent message | ||
245 | * @param hash Hash identifying the message | ||
246 | */ | ||
247 | typedef void | ||
248 | (*GNUNET_MESSENGER_MessageCallback) (void *cls, const struct GNUNET_MESSENGER_Room *room, | ||
249 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
250 | |||
251 | /** | ||
252 | * Set up a handle for the messenger related functions and connects to all necessary services. It will look up the ego | ||
253 | * key identified by its <i>name</i> and use it for signing all messages from the handle. | ||
254 | * | ||
255 | * @param cfg Configuration to use | ||
256 | * @param name Name to look up an ego or NULL to stay anonymous | ||
257 | * @param identity_callback Function called when the EGO of the handle changes | ||
258 | * @param identity_cls Closure for the <i>identity_callback</i> handler | ||
259 | * @param msg_callback Function called when a new message is sent or received | ||
260 | * @param msg_cls Closure for the <i>msg_callback</i> handler | ||
261 | * @return Messenger handle to use, NULL on error | ||
262 | */ | ||
263 | struct GNUNET_MESSENGER_Handle* | ||
264 | GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, | ||
265 | GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, | ||
266 | GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls); | ||
267 | |||
268 | /** | ||
269 | * Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. All | ||
270 | * participated rooms get informed about the key renewal. The handle requires a set name for this function to work and | ||
271 | * it needs to be unused by other egos. | ||
272 | * | ||
273 | * Keep in mind that this will fully delete the old ego key (if any is used) even if any other service wants to use it | ||
274 | * as default. | ||
275 | * | ||
276 | * @param handle Messenger handle to use | ||
277 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | ||
278 | */ | ||
279 | int | ||
280 | GNUNET_MESSENGER_update (struct GNUNET_MESSENGER_Handle *handle); | ||
281 | |||
282 | /** | ||
283 | * Disconnect all of the messengers used services and clears up its used memory. | ||
284 | * | ||
285 | * @param handle Messenger handle to use | ||
286 | */ | ||
287 | void | ||
288 | GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle); | ||
289 | |||
290 | /** | ||
291 | * Get the name (if specified, otherwise NULL) used by the messenger. | ||
292 | * | ||
293 | * @param handle Messenger handle to use | ||
294 | * @return Name used by the messenger or NULL | ||
295 | */ | ||
296 | const char* | ||
297 | GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle); | ||
298 | |||
299 | /** | ||
300 | * Set the name for the messenger. This will rename the currently used ego and move all stored files related to the current | ||
301 | * name to its new directory. If anything fails during this process the function returns GNUNET_NO and the name for | ||
302 | * the messenger won't change as specified. | ||
303 | * | ||
304 | * @param handle Messenger handle to use | ||
305 | * @param name Name for the messenger to change to | ||
306 | * @return GNUNET_YES on success, GNUNET_NO on failure and GNUNET_SYSERR if <i>handle</i> is NULL | ||
307 | */ | ||
308 | int | ||
309 | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); | ||
310 | |||
311 | /** | ||
312 | * Get the public key used by the messenger. | ||
313 | * | ||
314 | * @param handle Messenger handle to use | ||
315 | * @return Used ego's public key | ||
316 | */ | ||
317 | const struct GNUNET_IDENTITY_PublicKey* | ||
318 | GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); | ||
319 | |||
320 | /** | ||
321 | * Open a room to send and receive messages. The room will use the specified <i>key</i> as port for the underlying cadet | ||
322 | * service. Opening a room results in opening the port for incoming connections as possible <b>door</b>. | ||
323 | * | ||
324 | * Notice that there can only be one room related to a specific <i>key</i>. So trying to open two rooms with the same | ||
325 | * <i>key</i> will result in opening the room once but returning the handle both times because the room stays open. | ||
326 | * | ||
327 | * You can also open a room after entering it through a <b>door</b> using <i>GNUNET_MESSENGER_entry_room(...)</i>. This | ||
328 | * will notify all entered <b>doors</b> to list you as new <b>door</b>. | ||
329 | * | ||
330 | * ( All <b>doors</b> form a ring structured network to shorten the latency sending and receiving messages. ) | ||
331 | * | ||
332 | * @param handle Messenger handle to use | ||
333 | * @param key Hash identifying the port | ||
334 | * @return Room handle, NULL on error | ||
335 | */ | ||
336 | struct GNUNET_MESSENGER_Room* | ||
337 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | ||
338 | |||
339 | /** | ||
340 | * Enter a room to send and receive messages through a <b>door</b> opened using <i>GNUNET_MESSENGER_open_room(...)</i>. | ||
341 | * | ||
342 | * Notice that there can only be one room related to a specific <i>key</i>. So trying to enter two rooms with the same | ||
343 | * <i>key</i> will result in entering the room once but returning the handle both times because the room stays entered. | ||
344 | * You can however enter a room through multiple <b>doors</b> in parallel which results in connecting both ends. But | ||
345 | * entering the room through the same <b>door</b> won't have any effect after the first time. | ||
346 | * | ||
347 | * You can also enter a room through a <b>door</b> after opening it using <i>GNUNET_MESSENGER_open_room(...)</i>. But the | ||
348 | * <b>door</b> may not be your own peer identity. | ||
349 | * | ||
350 | * ( All <b>doors</b> form a ring structured network to shorten the latency sending and receiving messages. ) | ||
351 | * | ||
352 | * @param handle Messenger handle to use | ||
353 | * @param door Peer identity of an open <b>door</b> | ||
354 | * @param key Hash identifying the port | ||
355 | * @return Room handle, NULL on error | ||
356 | */ | ||
357 | struct GNUNET_MESSENGER_Room* | ||
358 | GNUNET_MESSENGER_entry_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | ||
359 | const struct GNUNET_HashCode *key); | ||
360 | |||
361 | /** | ||
362 | * Close a room which was entered, opened or both in various order and variety. Closing a room will destroy all connections | ||
363 | * from your peer to another and the other way around. | ||
364 | * | ||
365 | * ( After a member closes a <b>door</b>, all members entered through that specific <b>door</b> have to use another one | ||
366 | * or open the room on their own. ) | ||
367 | * | ||
368 | * @param room Room handle | ||
369 | */ | ||
370 | void | ||
371 | GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room); | ||
372 | |||
373 | /** | ||
374 | * Get the contact of a member in a <i>room</i> identified by their <i>id</i>. | ||
375 | * | ||
376 | * Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed. | ||
377 | * | ||
378 | * @param room Room handle | ||
379 | * @param id Hash identifying a member | ||
380 | * @return Contact handle, NULL if <i>id</i> is not in use | ||
381 | */ | ||
382 | struct GNUNET_MESSENGER_Contact* | ||
383 | GNUNET_MESSENGER_get_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id); | ||
384 | |||
385 | /** | ||
386 | * Get the name used by the <i>contact</i>. | ||
387 | * | ||
388 | * @param contact Contact handle | ||
389 | * @return Name of <i>contact</i> or NULL | ||
390 | */ | ||
391 | const char* | ||
392 | GNUNET_MESSENGER_contact_get_name (const struct GNUNET_MESSENGER_Contact *contact); | ||
393 | |||
394 | /** | ||
395 | * Get the public key used by the <i>contact</i>. | ||
396 | * | ||
397 | * @param contact Contact handle | ||
398 | * @return Public key of the ego used by <i>contact</i> | ||
399 | */ | ||
400 | const struct GNUNET_IDENTITY_PublicKey* | ||
401 | GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact); | ||
402 | |||
403 | /** | ||
404 | * Send a <i>message</i> into a </i>room</i>. If you opened the <i>room</i> all entered members will receive the | ||
405 | * <i>message</i>. If you entered the <i>room</i> through a <b>door</b> all so entered <b>doors</b> will receive the | ||
406 | * <i>message</i> as well. All members receiving the <i>message</i> will also propagate this <i>message</i> recursively | ||
407 | * as long as the <i>message</i> is unknown to them. | ||
408 | * | ||
409 | * Notice that all messages sent and received are also stored and can be propagated to new members entering the room. | ||
410 | * | ||
411 | * @param room Room handle | ||
412 | * @param message New message to send | ||
413 | */ | ||
414 | void | ||
415 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message); | ||
416 | |||
417 | /** | ||
418 | * Get the message in a <i>room</i> identified by its <i>hash</i>. | ||
419 | * | ||
420 | * @param room Room handle | ||
421 | * @param hash Hash identifying a message | ||
422 | * @return Message struct or NULL if no message with that hash is known | ||
423 | */ | ||
424 | const struct GNUNET_MESSENGER_Message* | ||
425 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | ||
426 | |||
427 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
428 | { | ||
429 | #endif | ||
430 | #ifdef __cplusplus | ||
431 | } | ||
432 | #endif | ||
433 | |||
434 | #endif //GNUNET_MESSENGER_SERVICE_H | ||
435 | |||
436 | /** @} *//* end of group */ | ||
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index 443c9e451..9cc8abc6e 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h | |||
@@ -58,7 +58,7 @@ typedef void | |||
58 | (*GNUNET_NAMESTORE_RecordIterator) (void *cls, | 58 | (*GNUNET_NAMESTORE_RecordIterator) (void *cls, |
59 | uint64_t serial, | 59 | uint64_t serial, |
60 | const struct | 60 | const struct |
61 | GNUNET_CRYPTO_EcdsaPrivateKey *private_key, | 61 | GNUNET_IDENTITY_PrivateKey *private_key, |
62 | const char *label, | 62 | const char *label, |
63 | unsigned int rd_count, | 63 | unsigned int rd_count, |
64 | const struct GNUNET_GNSRECORD_Data *rd); | 64 | const struct GNUNET_GNSRECORD_Data *rd); |
@@ -87,7 +87,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
87 | */ | 87 | */ |
88 | int | 88 | int |
89 | (*store_records) (void *cls, | 89 | (*store_records) (void *cls, |
90 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 90 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
91 | const char *label, | 91 | const char *label, |
92 | unsigned int rd_count, | 92 | unsigned int rd_count, |
93 | const struct GNUNET_GNSRECORD_Data *rd); | 93 | const struct GNUNET_GNSRECORD_Data *rd); |
@@ -104,7 +104,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
104 | */ | 104 | */ |
105 | int | 105 | int |
106 | (*lookup_records) (void *cls, | 106 | (*lookup_records) (void *cls, |
107 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 107 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
108 | const char *label, | 108 | const char *label, |
109 | GNUNET_NAMESTORE_RecordIterator iter, | 109 | GNUNET_NAMESTORE_RecordIterator iter, |
110 | void *iter_cls); | 110 | void *iter_cls); |
@@ -126,7 +126,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
126 | */ | 126 | */ |
127 | int | 127 | int |
128 | (*iterate_records) (void *cls, | 128 | (*iterate_records) (void *cls, |
129 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 129 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
130 | uint64_t serial, | 130 | uint64_t serial, |
131 | uint64_t limit, | 131 | uint64_t limit, |
132 | GNUNET_NAMESTORE_RecordIterator iter, | 132 | GNUNET_NAMESTORE_RecordIterator iter, |
@@ -146,8 +146,8 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
146 | */ | 146 | */ |
147 | int | 147 | int |
148 | (*zone_to_name) (void *cls, | 148 | (*zone_to_name) (void *cls, |
149 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 149 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
150 | const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 150 | const struct GNUNET_IDENTITY_PublicKey *value_zone, |
151 | GNUNET_NAMESTORE_RecordIterator iter, | 151 | GNUNET_NAMESTORE_RecordIterator iter, |
152 | void *iter_cls); | 152 | void *iter_cls); |
153 | }; | 153 | }; |
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index bf42c8d34..ca4d2cb52 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
42 | #include "gnunet_block_lib.h" | 42 | #include "gnunet_block_lib.h" |
43 | #include "gnunet_gnsrecord_lib.h" | 43 | #include "gnunet_gnsrecord_lib.h" |
44 | #include "gnunet_identity_service.h" | ||
44 | 45 | ||
45 | #ifdef __cplusplus | 46 | #ifdef __cplusplus |
46 | extern "C" | 47 | extern "C" |
@@ -127,7 +128,7 @@ typedef void | |||
127 | struct GNUNET_NAMESTORE_QueueEntry * | 128 | struct GNUNET_NAMESTORE_QueueEntry * |
128 | GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, | 129 | GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, |
129 | const struct | 130 | const struct |
130 | GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 131 | GNUNET_IDENTITY_PrivateKey *pkey, |
131 | const char *label, | 132 | const char *label, |
132 | unsigned int rd_count, | 133 | unsigned int rd_count, |
133 | const struct GNUNET_GNSRECORD_Data *rd, | 134 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -147,7 +148,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, | |||
147 | typedef void | 148 | typedef void |
148 | (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, | 149 | (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, |
149 | const struct | 150 | const struct |
150 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 151 | GNUNET_IDENTITY_PrivateKey *zone, |
151 | const char *label, | 152 | const char *label, |
152 | unsigned int rd_count, | 153 | unsigned int rd_count, |
153 | const struct GNUNET_GNSRECORD_Data *rd); | 154 | const struct GNUNET_GNSRECORD_Data *rd); |
@@ -170,7 +171,7 @@ typedef void | |||
170 | struct GNUNET_NAMESTORE_QueueEntry * | 171 | struct GNUNET_NAMESTORE_QueueEntry * |
171 | GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, | 172 | GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, |
172 | const struct | 173 | const struct |
173 | GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 174 | GNUNET_IDENTITY_PrivateKey *pkey, |
174 | const char *label, | 175 | const char *label, |
175 | GNUNET_SCHEDULER_TaskCallback error_cb, | 176 | GNUNET_SCHEDULER_TaskCallback error_cb, |
176 | void *error_cb_cls, | 177 | void *error_cb_cls, |
@@ -197,9 +198,9 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, | |||
197 | */ | 198 | */ |
198 | struct GNUNET_NAMESTORE_QueueEntry * | 199 | struct GNUNET_NAMESTORE_QueueEntry * |
199 | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | 200 | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, |
200 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 201 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
201 | const struct | 202 | const struct |
202 | GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 203 | GNUNET_IDENTITY_PublicKey *value_zone, |
203 | GNUNET_SCHEDULER_TaskCallback error_cb, | 204 | GNUNET_SCHEDULER_TaskCallback error_cb, |
204 | void *error_cb_cls, | 205 | void *error_cb_cls, |
205 | GNUNET_NAMESTORE_RecordMonitor proc, | 206 | GNUNET_NAMESTORE_RecordMonitor proc, |
@@ -246,7 +247,7 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | |||
246 | struct GNUNET_NAMESTORE_ZoneIterator * | 247 | struct GNUNET_NAMESTORE_ZoneIterator * |
247 | GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | 248 | GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, |
248 | const struct | 249 | const struct |
249 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 250 | GNUNET_IDENTITY_PrivateKey *zone, |
250 | GNUNET_SCHEDULER_TaskCallback error_cb, | 251 | GNUNET_SCHEDULER_TaskCallback error_cb, |
251 | void *error_cb_cls, | 252 | void *error_cb_cls, |
252 | GNUNET_NAMESTORE_RecordMonitor proc, | 253 | GNUNET_NAMESTORE_RecordMonitor proc, |
@@ -316,7 +317,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor * | |||
316 | GNUNET_NAMESTORE_zone_monitor_start (const struct | 317 | GNUNET_NAMESTORE_zone_monitor_start (const struct |
317 | GNUNET_CONFIGURATION_Handle *cfg, | 318 | GNUNET_CONFIGURATION_Handle *cfg, |
318 | const struct | 319 | const struct |
319 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 320 | GNUNET_IDENTITY_PrivateKey *zone, |
320 | int iterate_first, | 321 | int iterate_first, |
321 | GNUNET_SCHEDULER_TaskCallback error_cb, | 322 | GNUNET_SCHEDULER_TaskCallback error_cb, |
322 | void *error_cb_cls, | 323 | void *error_cb_cls, |
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index ca549f77c..de717526c 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2016, 2017 GNUnet e.V. | 3 | Copyright (C) 2016, 2017, 2020 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 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 | 6 | under the terms of the GNU Affero General Public License as published |
@@ -87,6 +87,7 @@ struct GNUNET_PQ_QueryParam | |||
87 | * Number of parameters eaten by this operation. | 87 | * Number of parameters eaten by this operation. |
88 | */ | 88 | */ |
89 | unsigned int num_params; | 89 | unsigned int num_params; |
90 | |||
90 | }; | 91 | }; |
91 | 92 | ||
92 | 93 | ||
@@ -100,20 +101,32 @@ struct GNUNET_PQ_QueryParam | |||
100 | 101 | ||
101 | 102 | ||
102 | /** | 103 | /** |
104 | * Generate query parameter to create a NULL value. | ||
105 | * | ||
106 | * @return query parameter to use to insert NULL into DB | ||
107 | */ | ||
108 | struct GNUNET_PQ_QueryParam | ||
109 | GNUNET_PQ_query_param_null (void); | ||
110 | |||
111 | |||
112 | /** | ||
103 | * Generate query parameter for a buffer @a ptr of | 113 | * Generate query parameter for a buffer @a ptr of |
104 | * @a ptr_size bytes. | 114 | * @a ptr_size bytes. |
105 | * | 115 | * |
106 | * @param ptr pointer to the query parameter to pass | 116 | * @param ptr pointer to the query parameter to pass |
107 | * @oaran ptr_size number of bytes in @a ptr | 117 | * @oaran ptr_size number of bytes in @a ptr |
118 | * @return query parameter to use | ||
108 | */ | 119 | */ |
109 | struct GNUNET_PQ_QueryParam | 120 | struct GNUNET_PQ_QueryParam |
110 | GNUNET_PQ_query_param_fixed_size (const void *ptr, size_t ptr_size); | 121 | GNUNET_PQ_query_param_fixed_size (const void *ptr, |
122 | size_t ptr_size); | ||
111 | 123 | ||
112 | 124 | ||
113 | /** | 125 | /** |
114 | * Generate query parameter for a string. | 126 | * Generate query parameter for a string. |
115 | * | 127 | * |
116 | * @param ptr pointer to the string query parameter to pass | 128 | * @param ptr pointer to the string query parameter to pass |
129 | * @return query parameter to use | ||
117 | */ | 130 | */ |
118 | struct GNUNET_PQ_QueryParam | 131 | struct GNUNET_PQ_QueryParam |
119 | GNUNET_PQ_query_param_string (const char *ptr); | 132 | GNUNET_PQ_query_param_string (const char *ptr); |
@@ -124,6 +137,7 @@ GNUNET_PQ_query_param_string (const char *ptr); | |||
124 | * by variable type. | 137 | * by variable type. |
125 | * | 138 | * |
126 | * @param x pointer to the query parameter to pass. | 139 | * @param x pointer to the query parameter to pass. |
140 | * @return query parameter to use | ||
127 | */ | 141 | */ |
128 | #define GNUNET_PQ_query_param_auto_from_type(x) \ | 142 | #define GNUNET_PQ_query_param_auto_from_type(x) \ |
129 | GNUNET_PQ_query_param_fixed_size ((x), sizeof(*(x))) | 143 | GNUNET_PQ_query_param_fixed_size ((x), sizeof(*(x))) |
@@ -134,6 +148,7 @@ GNUNET_PQ_query_param_string (const char *ptr); | |||
134 | * database must contain a BLOB type in the respective position. | 148 | * database must contain a BLOB type in the respective position. |
135 | * | 149 | * |
136 | * @param x the query parameter to pass. | 150 | * @param x the query parameter to pass. |
151 | * @return query parameter to use | ||
137 | */ | 152 | */ |
138 | struct GNUNET_PQ_QueryParam | 153 | struct GNUNET_PQ_QueryParam |
139 | GNUNET_PQ_query_param_rsa_public_key ( | 154 | GNUNET_PQ_query_param_rsa_public_key ( |
@@ -145,6 +160,7 @@ GNUNET_PQ_query_param_rsa_public_key ( | |||
145 | * database must contain a BLOB type in the respective position. | 160 | * database must contain a BLOB type in the respective position. |
146 | * | 161 | * |
147 | * @param x the query parameter to pass | 162 | * @param x the query parameter to pass |
163 | * @return query parameter to use | ||
148 | */ | 164 | */ |
149 | struct GNUNET_PQ_QueryParam | 165 | struct GNUNET_PQ_QueryParam |
150 | GNUNET_PQ_query_param_rsa_signature ( | 166 | GNUNET_PQ_query_param_rsa_signature ( |
@@ -156,6 +172,7 @@ GNUNET_PQ_query_param_rsa_signature ( | |||
156 | * The database must store a 64-bit integer. | 172 | * The database must store a 64-bit integer. |
157 | * | 173 | * |
158 | * @param x pointer to the query parameter to pass | 174 | * @param x pointer to the query parameter to pass |
175 | * @return query parameter to use | ||
159 | */ | 176 | */ |
160 | struct GNUNET_PQ_QueryParam | 177 | struct GNUNET_PQ_QueryParam |
161 | GNUNET_PQ_query_param_relative_time (const struct GNUNET_TIME_Relative *x); | 178 | GNUNET_PQ_query_param_relative_time (const struct GNUNET_TIME_Relative *x); |
@@ -166,6 +183,7 @@ GNUNET_PQ_query_param_relative_time (const struct GNUNET_TIME_Relative *x); | |||
166 | * The database must store a 64-bit integer. | 183 | * The database must store a 64-bit integer. |
167 | * | 184 | * |
168 | * @param x pointer to the query parameter to pass | 185 | * @param x pointer to the query parameter to pass |
186 | * @return query parameter to use | ||
169 | */ | 187 | */ |
170 | struct GNUNET_PQ_QueryParam | 188 | struct GNUNET_PQ_QueryParam |
171 | GNUNET_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x); | 189 | GNUNET_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x); |
@@ -176,6 +194,7 @@ GNUNET_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x); | |||
176 | * The database must store a 64-bit integer. | 194 | * The database must store a 64-bit integer. |
177 | * | 195 | * |
178 | * @param x pointer to the query parameter to pass | 196 | * @param x pointer to the query parameter to pass |
197 | * @return query parameter to use | ||
179 | */ | 198 | */ |
180 | struct GNUNET_PQ_QueryParam | 199 | struct GNUNET_PQ_QueryParam |
181 | GNUNET_PQ_query_param_absolute_time_nbo ( | 200 | GNUNET_PQ_query_param_absolute_time_nbo ( |
@@ -186,6 +205,7 @@ GNUNET_PQ_query_param_absolute_time_nbo ( | |||
186 | * Generate query parameter for an uint16_t in host byte order. | 205 | * Generate query parameter for an uint16_t in host byte order. |
187 | * | 206 | * |
188 | * @param x pointer to the query parameter to pass | 207 | * @param x pointer to the query parameter to pass |
208 | * @return query parameter to use | ||
189 | */ | 209 | */ |
190 | struct GNUNET_PQ_QueryParam | 210 | struct GNUNET_PQ_QueryParam |
191 | GNUNET_PQ_query_param_uint16 (const uint16_t *x); | 211 | GNUNET_PQ_query_param_uint16 (const uint16_t *x); |
@@ -195,6 +215,7 @@ GNUNET_PQ_query_param_uint16 (const uint16_t *x); | |||
195 | * Generate query parameter for an uint32_t in host byte order. | 215 | * Generate query parameter for an uint32_t in host byte order. |
196 | * | 216 | * |
197 | * @param x pointer to the query parameter to pass | 217 | * @param x pointer to the query parameter to pass |
218 | * @return query parameter to use | ||
198 | */ | 219 | */ |
199 | struct GNUNET_PQ_QueryParam | 220 | struct GNUNET_PQ_QueryParam |
200 | GNUNET_PQ_query_param_uint32 (const uint32_t *x); | 221 | GNUNET_PQ_query_param_uint32 (const uint32_t *x); |
@@ -204,6 +225,7 @@ GNUNET_PQ_query_param_uint32 (const uint32_t *x); | |||
204 | * Generate query parameter for an uint16_t in host byte order. | 225 | * Generate query parameter for an uint16_t in host byte order. |
205 | * | 226 | * |
206 | * @param x pointer to the query parameter to pass | 227 | * @param x pointer to the query parameter to pass |
228 | * @return query parameter to use | ||
207 | */ | 229 | */ |
208 | struct GNUNET_PQ_QueryParam | 230 | struct GNUNET_PQ_QueryParam |
209 | GNUNET_PQ_query_param_uint64 (const uint64_t *x); | 231 | GNUNET_PQ_query_param_uint64 (const uint64_t *x); |
@@ -288,6 +310,20 @@ struct GNUNET_PQ_ResultSpec | |||
288 | * Where to store actual size of the result. | 310 | * Where to store actual size of the result. |
289 | */ | 311 | */ |
290 | size_t *result_size; | 312 | size_t *result_size; |
313 | |||
314 | /** | ||
315 | * True if NULL is allowed for a value in the database. | ||
316 | */ | ||
317 | bool is_nullable; | ||
318 | |||
319 | /** | ||
320 | * Points to a location where we should store | ||
321 | * "true" if the result found is NULL, and | ||
322 | * otherwise "false". Only used if @e is_nullable | ||
323 | * is true. | ||
324 | */ | ||
325 | bool *is_null; | ||
326 | |||
291 | }; | 327 | }; |
292 | 328 | ||
293 | 329 | ||
@@ -303,6 +339,21 @@ struct GNUNET_PQ_ResultSpec | |||
303 | 339 | ||
304 | 340 | ||
305 | /** | 341 | /** |
342 | * Allow NULL value to be found in the database | ||
343 | * for the given value. | ||
344 | * | ||
345 | * @param rs result spec entry to modify | ||
346 | * @param[out] is_null location set to 'true' if the | ||
347 | * value was indeed NULL, set to 'false' if the | ||
348 | * value was non-NULL | ||
349 | * @return array entry for the result specification to use | ||
350 | */ | ||
351 | struct GNUNET_PQ_ResultSpec | ||
352 | GNUNET_PQ_result_spec_allow_null (struct GNUNET_PQ_ResultSpec rs, | ||
353 | bool *is_null); | ||
354 | |||
355 | |||
356 | /** | ||
306 | * Variable-size result expected. | 357 | * Variable-size result expected. |
307 | * | 358 | * |
308 | * @param name name of the field in the table | 359 | * @param name name of the field in the table |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index d9821ffe8..3bdebeb50 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2001--2018 GNUnet e.V. | 3 | Copyright (C) 2001--2020 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 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 | 6 | under the terms of the GNU Affero General Public License as published |
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @author Christian Grothoff | 22 | * @author Christian Grothoff |
23 | * @author Tobias Frisch | ||
23 | * | 24 | * |
24 | * @file | 25 | * @file |
25 | * Constants for network protocols | 26 | * Constants for network protocols |
@@ -3518,6 +3519,46 @@ extern "C" { | |||
3518 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT 1501 | 3519 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT 1501 |
3519 | 3520 | ||
3520 | 3521 | ||
3522 | /*********************************************************************************/ | ||
3523 | /********************************** MESSENGER **********************************/ | ||
3524 | /*********************************************************************************/ | ||
3525 | /* MESSENGER: message types 1600-1629 | ||
3526 | * 1600-1609 Connection-level Messages | ||
3527 | * 1610-1619 Room-level Messages | ||
3528 | */ | ||
3529 | |||
3530 | /********************************* Connection **********************************/ | ||
3531 | |||
3532 | #define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_CREATE 1600 | ||
3533 | |||
3534 | #define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_UPDATE 1601 | ||
3535 | |||
3536 | #define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_DESTROY 1602 | ||
3537 | |||
3538 | #define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_NAME 1603 | ||
3539 | |||
3540 | #define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_SET_NAME 1604 | ||
3541 | |||
3542 | #define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY 1605 | ||
3543 | |||
3544 | #define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID 1606 | ||
3545 | |||
3546 | /************************************ Room *************************************/ | ||
3547 | |||
3548 | #define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN 1610 | ||
3549 | |||
3550 | #define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY 1611 | ||
3551 | |||
3552 | #define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE 1612 | ||
3553 | |||
3554 | #define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SEND_MESSAGE 1614 | ||
3555 | |||
3556 | #define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE 1615 | ||
3557 | |||
3558 | #define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE 1616 | ||
3559 | |||
3560 | /*********************************************************************************/ | ||
3561 | |||
3521 | /** | 3562 | /** |
3522 | * Type used to match 'all' message types. | 3563 | * Type used to match 'all' message types. |
3523 | */ | 3564 | */ |
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index 368058f56..8549081a1 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h | |||
@@ -38,6 +38,7 @@ extern "C" { | |||
38 | #endif | 38 | #endif |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #include "gnunet_identity_service.h" | ||
41 | #include "gnunet_reclaim_lib.h" | 42 | #include "gnunet_reclaim_lib.h" |
42 | #include "gnunet_util_lib.h" | 43 | #include "gnunet_util_lib.h" |
43 | 44 | ||
@@ -69,12 +70,12 @@ struct GNUNET_RECLAIM_Ticket | |||
69 | /** | 70 | /** |
70 | * The ticket issuer (= the user) | 71 | * The ticket issuer (= the user) |
71 | */ | 72 | */ |
72 | struct GNUNET_CRYPTO_EcdsaPublicKey identity; | 73 | struct GNUNET_IDENTITY_PublicKey identity; |
73 | 74 | ||
74 | /** | 75 | /** |
75 | * The ticket audience (= relying party) | 76 | * The ticket audience (= relying party) |
76 | */ | 77 | */ |
77 | struct GNUNET_CRYPTO_EcdsaPublicKey audience; | 78 | struct GNUNET_IDENTITY_PublicKey audience; |
78 | 79 | ||
79 | /** | 80 | /** |
80 | * The ticket random identifier | 81 | * The ticket random identifier |
@@ -129,7 +130,7 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, | |||
129 | * @param attr The attribute | 130 | * @param attr The attribute |
130 | */ | 131 | */ |
131 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( | 132 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( |
132 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 133 | void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, |
133 | const struct GNUNET_RECLAIM_Attribute *attr); | 134 | const struct GNUNET_RECLAIM_Attribute *attr); |
134 | 135 | ||
135 | /** | 136 | /** |
@@ -141,7 +142,7 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) ( | |||
141 | * @param presentation The presentation for the credential (may be NULL) | 142 | * @param presentation The presentation for the credential (may be NULL) |
142 | */ | 143 | */ |
143 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( | 144 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( |
144 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 145 | void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, |
145 | const struct GNUNET_RECLAIM_Attribute *attr, | 146 | const struct GNUNET_RECLAIM_Attribute *attr, |
146 | const struct GNUNET_RECLAIM_Presentation *presentation); | 147 | const struct GNUNET_RECLAIM_Presentation *presentation); |
147 | 148 | ||
@@ -155,7 +156,7 @@ typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( | |||
155 | * @param attributes the parsed attributes | 156 | * @param attributes the parsed attributes |
156 | */ | 157 | */ |
157 | typedef void (*GNUNET_RECLAIM_CredentialResult) ( | 158 | typedef void (*GNUNET_RECLAIM_CredentialResult) ( |
158 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 159 | void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, |
159 | const struct GNUNET_RECLAIM_Credential *credential); | 160 | const struct GNUNET_RECLAIM_Credential *credential); |
160 | 161 | ||
161 | 162 | ||
@@ -184,7 +185,7 @@ GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
184 | struct GNUNET_RECLAIM_Operation * | 185 | struct GNUNET_RECLAIM_Operation * |
185 | GNUNET_RECLAIM_attribute_store ( | 186 | GNUNET_RECLAIM_attribute_store ( |
186 | struct GNUNET_RECLAIM_Handle *h, | 187 | struct GNUNET_RECLAIM_Handle *h, |
187 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 188 | const struct GNUNET_IDENTITY_PrivateKey *pkey, |
188 | const struct GNUNET_RECLAIM_Attribute *attr, | 189 | const struct GNUNET_RECLAIM_Attribute *attr, |
189 | const struct GNUNET_TIME_Relative *exp_interval, | 190 | const struct GNUNET_TIME_Relative *exp_interval, |
190 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); | 191 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); |
@@ -205,7 +206,7 @@ GNUNET_RECLAIM_attribute_store ( | |||
205 | struct GNUNET_RECLAIM_Operation * | 206 | struct GNUNET_RECLAIM_Operation * |
206 | GNUNET_RECLAIM_credential_store ( | 207 | GNUNET_RECLAIM_credential_store ( |
207 | struct GNUNET_RECLAIM_Handle *h, | 208 | struct GNUNET_RECLAIM_Handle *h, |
208 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 209 | const struct GNUNET_IDENTITY_PrivateKey *pkey, |
209 | const struct GNUNET_RECLAIM_Credential *credential, | 210 | const struct GNUNET_RECLAIM_Credential *credential, |
210 | const struct GNUNET_TIME_Relative *exp_interval, | 211 | const struct GNUNET_TIME_Relative *exp_interval, |
211 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 212 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
@@ -226,7 +227,7 @@ GNUNET_RECLAIM_credential_store ( | |||
226 | struct GNUNET_RECLAIM_Operation * | 227 | struct GNUNET_RECLAIM_Operation * |
227 | GNUNET_RECLAIM_attribute_delete ( | 228 | GNUNET_RECLAIM_attribute_delete ( |
228 | struct GNUNET_RECLAIM_Handle *h, | 229 | struct GNUNET_RECLAIM_Handle *h, |
229 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 230 | const struct GNUNET_IDENTITY_PrivateKey *pkey, |
230 | const struct GNUNET_RECLAIM_Attribute *attr, | 231 | const struct GNUNET_RECLAIM_Attribute *attr, |
231 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); | 232 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); |
232 | 233 | ||
@@ -244,7 +245,7 @@ GNUNET_RECLAIM_attribute_delete ( | |||
244 | struct GNUNET_RECLAIM_Operation * | 245 | struct GNUNET_RECLAIM_Operation * |
245 | GNUNET_RECLAIM_credential_delete ( | 246 | GNUNET_RECLAIM_credential_delete ( |
246 | struct GNUNET_RECLAIM_Handle *h, | 247 | struct GNUNET_RECLAIM_Handle *h, |
247 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 248 | const struct GNUNET_IDENTITY_PrivateKey *pkey, |
248 | const struct GNUNET_RECLAIM_Credential *cred, | 249 | const struct GNUNET_RECLAIM_Credential *cred, |
249 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 250 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
250 | void *cont_cls); | 251 | void *cont_cls); |
@@ -276,7 +277,7 @@ GNUNET_RECLAIM_credential_delete ( | |||
276 | struct GNUNET_RECLAIM_AttributeIterator * | 277 | struct GNUNET_RECLAIM_AttributeIterator * |
277 | GNUNET_RECLAIM_get_attributes_start ( | 278 | GNUNET_RECLAIM_get_attributes_start ( |
278 | struct GNUNET_RECLAIM_Handle *h, | 279 | struct GNUNET_RECLAIM_Handle *h, |
279 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 280 | const struct GNUNET_IDENTITY_PrivateKey *identity, |
280 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, | 281 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, |
281 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, | 282 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, |
282 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); | 283 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); |
@@ -332,7 +333,7 @@ GNUNET_RECLAIM_get_attributes_stop ( | |||
332 | struct GNUNET_RECLAIM_CredentialIterator * | 333 | struct GNUNET_RECLAIM_CredentialIterator * |
333 | GNUNET_RECLAIM_get_credentials_start ( | 334 | GNUNET_RECLAIM_get_credentials_start ( |
334 | struct GNUNET_RECLAIM_Handle *h, | 335 | struct GNUNET_RECLAIM_Handle *h, |
335 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 336 | const struct GNUNET_IDENTITY_PrivateKey *identity, |
336 | GNUNET_SCHEDULER_TaskCallback error_cb, | 337 | GNUNET_SCHEDULER_TaskCallback error_cb, |
337 | void *error_cb_cls, | 338 | void *error_cb_cls, |
338 | GNUNET_RECLAIM_CredentialResult proc, | 339 | GNUNET_RECLAIM_CredentialResult proc, |
@@ -380,8 +381,8 @@ GNUNET_RECLAIM_get_credentials_stop ( | |||
380 | struct GNUNET_RECLAIM_Operation * | 381 | struct GNUNET_RECLAIM_Operation * |
381 | GNUNET_RECLAIM_ticket_issue ( | 382 | GNUNET_RECLAIM_ticket_issue ( |
382 | struct GNUNET_RECLAIM_Handle *h, | 383 | struct GNUNET_RECLAIM_Handle *h, |
383 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, | 384 | const struct GNUNET_IDENTITY_PrivateKey *iss, |
384 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, | 385 | const struct GNUNET_IDENTITY_PublicKey *rp, |
385 | const struct GNUNET_RECLAIM_AttributeList *attrs, | 386 | const struct GNUNET_RECLAIM_AttributeList *attrs, |
386 | GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); | 387 | GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); |
387 | 388 | ||
@@ -402,7 +403,7 @@ GNUNET_RECLAIM_ticket_issue ( | |||
402 | struct GNUNET_RECLAIM_Operation * | 403 | struct GNUNET_RECLAIM_Operation * |
403 | GNUNET_RECLAIM_ticket_revoke ( | 404 | GNUNET_RECLAIM_ticket_revoke ( |
404 | struct GNUNET_RECLAIM_Handle *h, | 405 | struct GNUNET_RECLAIM_Handle *h, |
405 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 406 | const struct GNUNET_IDENTITY_PrivateKey *identity, |
406 | const struct GNUNET_RECLAIM_Ticket *ticket, | 407 | const struct GNUNET_RECLAIM_Ticket *ticket, |
407 | GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls); | 408 | GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls); |
408 | 409 | ||
@@ -422,7 +423,7 @@ GNUNET_RECLAIM_ticket_revoke ( | |||
422 | struct GNUNET_RECLAIM_Operation * | 423 | struct GNUNET_RECLAIM_Operation * |
423 | GNUNET_RECLAIM_ticket_consume ( | 424 | GNUNET_RECLAIM_ticket_consume ( |
424 | struct GNUNET_RECLAIM_Handle *h, | 425 | struct GNUNET_RECLAIM_Handle *h, |
425 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 426 | const struct GNUNET_IDENTITY_PrivateKey *identity, |
426 | const struct GNUNET_RECLAIM_Ticket *ticket, | 427 | const struct GNUNET_RECLAIM_Ticket *ticket, |
427 | GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls); | 428 | GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls); |
428 | 429 | ||
@@ -447,7 +448,7 @@ GNUNET_RECLAIM_ticket_consume ( | |||
447 | struct GNUNET_RECLAIM_TicketIterator * | 448 | struct GNUNET_RECLAIM_TicketIterator * |
448 | GNUNET_RECLAIM_ticket_iteration_start ( | 449 | GNUNET_RECLAIM_ticket_iteration_start ( |
449 | struct GNUNET_RECLAIM_Handle *h, | 450 | struct GNUNET_RECLAIM_Handle *h, |
450 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 451 | const struct GNUNET_IDENTITY_PrivateKey *identity, |
451 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, | 452 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, |
452 | GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, | 453 | GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, |
453 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); | 454 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); |
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h index 105bb1149..d56116914 100644 --- a/src/include/gnunet_revocation_service.h +++ b/src/include/gnunet_revocation_service.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #ifndef GNUNET_REVOCATION_SERVICE_H_ | 21 | #ifndef GNUNET_REVOCATION_SERVICE_H_ |
22 | #define GNUNET_REVOCATION_SERVICE_H_ | 22 | #define GNUNET_REVOCATION_SERVICE_H_ |
23 | 23 | ||
24 | #include "gnunet_identity_service.h" | ||
25 | |||
24 | /** | 26 | /** |
25 | * @author Christian Grothoff | 27 | * @author Christian Grothoff |
26 | * | 28 | * |
@@ -51,6 +53,13 @@ extern "C" | |||
51 | #define GNUNET_REVOCATION_VERSION 0x00000001 | 53 | #define GNUNET_REVOCATION_VERSION 0x00000001 |
52 | 54 | ||
53 | /** | 55 | /** |
56 | * Maximum length of a revocation | ||
57 | */ | ||
58 | #define GNUNET_REVOCATION_MAX_PROOF_SIZE sizeof(struct GNUNET_REVOCATION_PowP) +\ | ||
59 | sizeof(struct GNUNET_IDENTITY_PublicKey) +\ | ||
60 | 1024 //FIXME max sig_len | ||
61 | |||
62 | /** | ||
54 | * The proof-of-work narrowing factor. | 63 | * The proof-of-work narrowing factor. |
55 | * The number of PoWs that are calculates as part of revocation. | 64 | * The number of PoWs that are calculates as part of revocation. |
56 | */ | 65 | */ |
@@ -79,15 +88,7 @@ struct GNUNET_REVOCATION_PowP | |||
79 | */ | 88 | */ |
80 | uint64_t pow[POW_COUNT] GNUNET_PACKED; | 89 | uint64_t pow[POW_COUNT] GNUNET_PACKED; |
81 | 90 | ||
82 | /** | 91 | /** followed by the public key type, the key and a signature **/ |
83 | * The signature | ||
84 | */ | ||
85 | struct GNUNET_CRYPTO_EcdsaSignature signature; | ||
86 | |||
87 | /** | ||
88 | * The revoked public key | ||
89 | */ | ||
90 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | ||
91 | }; | 92 | }; |
92 | 93 | ||
93 | 94 | ||
@@ -102,14 +103,11 @@ struct GNUNET_REVOCATION_SignaturePurposePS | |||
102 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; | 103 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; |
103 | 104 | ||
104 | /** | 105 | /** |
105 | * The revoked public key | ||
106 | */ | ||
107 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | ||
108 | |||
109 | /** | ||
110 | * The timestamp of the revocation | 106 | * The timestamp of the revocation |
111 | */ | 107 | */ |
112 | struct GNUNET_TIME_AbsoluteNBO timestamp; | 108 | struct GNUNET_TIME_AbsoluteNBO timestamp; |
109 | |||
110 | /** Followed by the zone public key type and key **/ | ||
113 | }; | 111 | }; |
114 | 112 | ||
115 | GNUNET_NETWORK_STRUCT_END | 113 | GNUNET_NETWORK_STRUCT_END |
@@ -150,7 +148,7 @@ typedef void (*GNUNET_REVOCATION_Callback) (void *cls, | |||
150 | */ | 148 | */ |
151 | struct GNUNET_REVOCATION_Query * | 149 | struct GNUNET_REVOCATION_Query * |
152 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | 150 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, |
153 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 151 | const struct GNUNET_IDENTITY_PublicKey *key, |
154 | GNUNET_REVOCATION_Callback func, void *func_cls); | 152 | GNUNET_REVOCATION_Callback func, void *func_cls); |
155 | 153 | ||
156 | 154 | ||
@@ -217,7 +215,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
217 | * @param pow the pow object to work with in the calculation. | 215 | * @param pow the pow object to work with in the calculation. |
218 | */ | 216 | */ |
219 | void | 217 | void |
220 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 218 | GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key, |
221 | struct GNUNET_REVOCATION_PowP *pow); | 219 | struct GNUNET_REVOCATION_PowP *pow); |
222 | 220 | ||
223 | 221 | ||
@@ -256,6 +254,10 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc); | |||
256 | void | 254 | void |
257 | GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc); | 255 | GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc); |
258 | 256 | ||
257 | size_t | ||
258 | GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow); | ||
259 | |||
260 | |||
259 | #if 0 /* keep Emacsens' auto-indent happy */ | 261 | #if 0 /* keep Emacsens' auto-indent happy */ |
260 | { | 262 | { |
261 | #endif | 263 | #endif |
diff --git a/src/include/gnunet_uri_lib.h b/src/include/gnunet_uri_lib.h index d428bdd9a..57c9e9316 100644 --- a/src/include/gnunet_uri_lib.h +++ b/src/include/gnunet_uri_lib.h | |||
@@ -26,12 +26,13 @@ | |||
26 | /** | 26 | /** |
27 | * The struct where the parsed values will be stored: | 27 | * The struct where the parsed values will be stored: |
28 | * | 28 | * |
29 | * scheme ":" [ "//" ] [ username ":" password "@" ] host [ ":" port ] [ "/" ] [ path ] [ "?" query ] | 29 | * scheme ":" [ "//" ] [ username ":" password "@" ] host [ ":" port ] [ "/" ] [ path ] [ "?" query ] [ "#" fragment ] |
30 | * | 30 | * |
31 | * Note: to make sure that no strings are copied, the first slash "/" in the | 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. | 32 | * path will be used to null terminate the hostname if no port is supplied. |
33 | */ | 33 | */ |
34 | struct GNUNET_Uri { | 34 | struct GNUNET_Uri |
35 | { | ||
35 | char *scheme; /* scheme, without ":" and "//" */ | 36 | char *scheme; /* scheme, without ":" and "//" */ |
36 | char *username; /* username, default: NULL */ | 37 | char *username; /* username, default: NULL */ |
37 | char *password; /* password, default: NULL */ | 38 | char *password; /* password, default: NULL */ |
@@ -44,7 +45,8 @@ struct GNUNET_Uri { | |||
44 | 45 | ||
45 | 46 | ||
46 | /* A struct to hold the query string parameter values. */ | 47 | /* A struct to hold the query string parameter values. */ |
47 | struct GNUNET_UriParam { | 48 | struct GNUNET_UriParam |
49 | { | ||
48 | char *key; | 50 | char *key; |
49 | char *val; | 51 | char *val; |
50 | }; | 52 | }; |