GNUnet 0.29.0
 
Loading...
Searching...
No Matches
gnunet_hello_uri_lib.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2022, 2026 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
35#ifndef GNUNET_HELLO_URI_LIB_H
36#define GNUNET_HELLO_URI_LIB_H
37
38#ifdef __cplusplus
39extern "C" {
40#if 0 /* keep Emacsens' auto-indent happy */
41}
42#endif
43#endif
44
45
46#include "gnunet_util_lib.h"
47
48
53
58
59
63#define GNUNET_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply ( \
64 GNUNET_TIME_UNIT_DAYS, 2)
65
66
74
75
85 struct GNUNET_PeerIdentity *pid);
86
90const struct GNUNET_PeerIdentity *
92
93
99void
101
107void
109
110
118struct GNUNET_HELLO_Parser *
120 const struct GNUNET_PeerIdentity *pid);
121
122
134struct GNUNET_HELLO_Parser *
136 const struct GNUNET_PeerIdentity *pid,
137 int noverify);
138
139
147struct GNUNET_HELLO_Parser *
148GNUNET_HELLO_parser_from_block (const void *block,
149 size_t block_size);
150
159struct GNUNET_HELLO_Parser *
160GNUNET_HELLO_parser_from_block_ (const void *block,
161 size_t block_size,
162 int noverify);
163
170struct GNUNET_HELLO_Parser *
171GNUNET_HELLO_parser_from_url (const char *url);
172
173
183
184
192struct GNUNET_MQ_Envelope *
194
195
202char *
204
205
218 void *block, size_t *block_size);
219
230 const char *address);
231
232
243 const char *address);
244
245
252typedef void
253(*GNUNET_HELLO_UriCallback) (void *cls,
254 const struct GNUNET_PeerIdentity *pid,
255 const char *uri);
256
257
266void
269 void *uc_cls);
270
279const struct GNUNET_PeerIdentity *
282 void *uc_cls);
283
284
299 const struct GNUNET_PeerIdentity *pid,
300 void **block,
301 size_t *block_size,
302 struct GNUNET_TIME_Absolute *block_expiration);
303
304
312char *
314
323 const struct GNUNET_PeerIdentity *pid,
324 const struct GNUNET_CRYPTO_EddsaSignature *sig,
326 char **result);
327
339 const struct GNUNET_HELLO_Builder *builder,
340 const struct GNUNET_PeerIdentity *pid,
341 const struct GNUNET_CRYPTO_EddsaSignature *sig,
342 struct GNUNET_TIME_Absolute expiration_time);
343
352 const struct GNUNET_HELLO_Parser *parser);
353
363void
365 const struct GNUNET_HELLO_Builder *builder,
366 const struct GNUNET_PeerIdentity *pid,
367 const struct GNUNET_CRYPTO_EddsaSignature *sig,
368 struct GNUNET_TIME_Absolute expiration_time,
369 char *outbuf);
370
379void
381 struct GNUNET_HashCode *hash);
382
393struct GNUNET_MQ_Envelope*
395 const struct GNUNET_HELLO_Builder *builder,
396 const struct GNUNET_PeerIdentity *pid,
397 const struct GNUNET_CRYPTO_EddsaSignature *sig,
398 struct GNUNET_TIME_Absolute expiration_time);
399
406size_t
408 builder);
409
420 const struct GNUNET_HELLO_Builder *builder,
421 const struct GNUNET_PeerIdentity *pid,
422 const struct GNUNET_CRYPTO_EddsaSignature *sig,
423 char **result);
424
425
437 const struct GNUNET_HELLO_Builder *builder,
438 const struct GNUNET_PeerIdentity *pid,
439 const struct GNUNET_CRYPTO_EddsaSignature *sig,
440 struct GNUNET_TIME_Absolute validity,
441 char **result);
442
455 abuilder,
456 const struct GNUNET_HELLO_Builder *
457 bbuilder);
458
459#if 0 /* keep Emacsens' auto-indent happy */
460{
461#endif
462#ifdef __cplusplus
463}
464#endif
465
466/* ifndef GNUNET_HELLO_URI_LIB_H */
467#endif
468
/* end of group */
470
/* end of group addition */
472
473/* end of gnunet_hello_uri_lib.h */
struct GNUNET_MessageHeader * msg
Definition 005.c:2
static char * address
GNS address for this phone.
static struct HostSet * builder
NULL if we are not currently iterating over peer information.
static struct GNUNET_TIME_Relative expiration
User supplied expiration value.
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
static int result
Global testing status.
static struct GNUNET_FS_UnindexContext * uc
void GNUNET_HELLO_parser_free(struct GNUNET_HELLO_Parser *parser)
Release resources of a builder.
Definition hello-uri.c:380
void GNUNET_HELLO_builder_to_block(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute expiration_time, char *outbuf)
Generate DHT block from a builder.
Definition hello-uri.c:1322
void GNUNET_HELLO_builder_free(struct GNUNET_HELLO_Builder *builder)
Release resources of a builder.
Definition hello-uri.c:398
char * GNUNET_HELLO_parser_to_url(const struct GNUNET_HELLO_Parser *parser)
Generate GNUnet HELLO URI from a parser.
Definition hello-uri.c:880
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_new()
Allocate builder.
Definition hello-uri.c:344
enum GNUNET_GenericReturnValue GNUNET_HELLO_dht_msg_to_block(const struct GNUNET_MessageHeader *hello, const struct GNUNET_PeerIdentity *pid, void **block, size_t *block_size, struct GNUNET_TIME_Absolute *block_expiration)
Convert a DHT hello message to a HELLO block.
Definition hello-uri.c:1074
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_block_(const void *block, size_t block_size, int noverify)
Parse block.
Definition hello-uri.c:592
void GNUNET_HELLO_builder_iterate(const struct GNUNET_HELLO_Builder *builder, GNUNET_HELLO_UriCallback uc, void *uc_cls)
Iterate over URIs in a builder.
Definition hello-uri.c:1033
enum GNUNET_GenericReturnValue GNUNET_HELLO_parser_to_block(const struct GNUNET_HELLO_Parser *parser, void *block, size_t *block_size)
Generate DHT block from a parser.
Definition hello-uri.c:937
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_to_url(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, char **result)
Generate GNUnet HELLO URI from a builder.
Definition hello-uri.c:1372
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_from_parser(const struct GNUNET_HELLO_Parser *parser, struct GNUNET_PeerIdentity *pid)
Allocate builder from parser.
Definition hello-uri.c:361
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_msg_(const struct GNUNET_MessageHeader *msg, const struct GNUNET_PeerIdentity *pid, int noverify)
Parse msg.
Definition hello-uri.c:426
const struct GNUNET_PeerIdentity * GNUNET_HELLO_parser_iterate(const struct GNUNET_HELLO_Parser *parser, GNUNET_HELLO_UriCallback uc, void *uc_cls)
Iterate over URIs in a parser.
Definition hello-uri.c:1052
struct GNUNET_MessageHeader * GNUNET_HELLO_parser_to_dht_hello_msg(const struct GNUNET_HELLO_Parser *parser)
Generate DHT HELLO message from a parser.
Definition hello-uri.c:1249
enum GNUNET_GenericReturnValue GNUNET_HELLO_build_url(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute expiration, char **result)
Definition hello-uri.c:1151
struct GNUNET_MQ_Envelope * GNUNET_HELLO_parser_to_env(const struct GNUNET_HELLO_Parser *parser)
Generate envelope with GNUnet HELLO message (including peer ID) from a parser.
Definition hello-uri.c:980
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_address_list_cmp(const struct GNUNET_HELLO_Builder *abuilder, const struct GNUNET_HELLO_Builder *bbuilder)
Compare address lists of two builders.
Definition hello-uri.c:1408
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_del_address(struct GNUNET_HELLO_Builder *builder, const char *address)
Remove individual address from the builder.
Definition hello-uri.c:1009
struct GNUNET_TIME_Absolute GNUNET_HELLO_get_expiration_time_from_msg(const struct GNUNET_MessageHeader *msg)
Get the expiration time for this HELLO.
Definition hello-uri.c:655
size_t GNUNET_HELLO_get_builder_to_block_size(const struct GNUNET_HELLO_Builder *builder)
Get projected block size for builder.
Definition hello-uri.c:1390
const struct GNUNET_PeerIdentity * GNUNET_HELLO_parser_get_id(const struct GNUNET_HELLO_Parser *parser)
Get the PeerIdentity for this builder.
Definition hello-uri.c:354
void(* GNUNET_HELLO_UriCallback)(void *cls, const struct GNUNET_PeerIdentity *pid, const char *uri)
Callback function used to extract URIs from a builder.
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_msg(const struct GNUNET_MessageHeader *msg, const struct GNUNET_PeerIdentity *pid)
Parse msg.
Definition hello-uri.c:416
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_add_address(struct GNUNET_HELLO_Builder *builder, const char *address)
Add individual address to the builder.
Definition hello-uri.c:701
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_url(const char *url)
Parse GNUnet HELLO url.
Definition hello-uri.c:740
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_to_url2(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute validity, char **result)
Generate GNUnet HELLO URI from a builder.
Definition hello-uri.c:1357
struct GNUNET_MessageHeader * GNUNET_HELLO_builder_to_dht_hello_msg(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute expiration_time)
Generate DHT HELLO message (without peer ID) from a builder.
Definition hello-uri.c:1287
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_block(const void *block, size_t block_size)
Parse block.
Definition hello-uri.c:582
char * GNUNET_HELLO_address_to_prefix(const char *address)
Given an address as a string, extract the prefix that identifies the communicator offering transmissi...
Definition hello-uri.c:1139
void GNUNET_HELLO_builder_hash_addresses(const struct GNUNET_HELLO_Builder *builder, struct GNUNET_HashCode *hash)
Compute hash over addresses in builder.
Definition hello-uri.c:1211
struct GNUNET_MQ_Envelope * GNUNET_HELLO_builder_to_env(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute expiration_time)
Generate envelope with GNUnet HELLO message (including peer ID) from a builder.
Definition hello-uri.c:1219
GNUNET_GenericReturnValue
Named constants for return values.
an ECC signature using EdDSA.
Context for building (or parsing) HELLO URIs.
Definition hello-uri.c:185
Context for parsing HELLOs.
Definition hello-uri.c:233
struct GNUNET_PeerIdentity pid
Public key of the peer.
Definition hello-uri.c:237
A 512-bit hashcode.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.