GNUnet 0.22.0
gnunet_hello_uri_lib.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2022 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
75
76
85
89const struct GNUNET_PeerIdentity *
91
92
98void
100
106void
108
109
116struct GNUNET_HELLO_Parser *
118
119
127struct GNUNET_HELLO_Parser *
128GNUNET_HELLO_parser_from_block (const void *block,
129 size_t block_size);
130
131
138struct GNUNET_HELLO_Parser *
139GNUNET_HELLO_parser_from_url (const char *url);
140
141
151
152
161struct GNUNET_MQ_Envelope *
163 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
164 struct GNUNET_TIME_Relative expiration_time);
165
166
174struct GNUNET_MQ_Envelope *
176
186 const struct GNUNET_HELLO_Builder *builder,
187 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
188 struct GNUNET_TIME_Relative expiration_time);
189
196char *
198
206char *
208 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
209
218char *
220 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
221 struct GNUNET_TIME_Relative expiration_time);
222
236 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
237 void *block,
238 size_t *block_size,
239 struct GNUNET_TIME_Relative expiration_time);
240
241
254 void *block, size_t *block_size);
255
266 const char *address);
267
268
279 const char *address);
280
281
288typedef void
289(*GNUNET_HELLO_UriCallback) (void *cls,
290 const struct GNUNET_PeerIdentity *pid,
291 const char *uri);
292
293
302const struct GNUNET_PeerIdentity *
305 void *uc_cls);
306
307
322 const struct GNUNET_PeerIdentity *pid,
323 void **block,
324 size_t *block_size,
325 struct GNUNET_TIME_Absolute *block_expiration);
326
327
335char *
337
348void
350 const char *address,
352 struct GNUNET_TIME_Absolute mono_time,
353 const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key,
354 void **result,
355 size_t *result_size);
356
357#if 0 /* keep Emacsens' auto-indent happy */
358{
359#endif
360#ifdef __cplusplus
361}
362#endif
363
364/* ifndef GNUNET_HELLO_URI_LIB_H */
365#endif
366 /* end of group */
368 /* end of group addition */
370
371/* 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_NAT_AUTO_Test * nt
Handle to a NAT test operation.
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_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_FS_UnindexContext * uc
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_from_parser(const struct GNUNET_HELLO_Parser *parser)
Allocate builder from parser.
Definition: hello-uri.c:419
void GNUNET_HELLO_parser_free(struct GNUNET_HELLO_Parser *parser)
Release resources of a builder.
Definition: hello-uri.c:435
void GNUNET_HELLO_sign_address(const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Absolute mono_time, const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, void **result, size_t *result_size)
Build address record by signing raw information with private key.
Definition: hello-ng.c:66
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_msg(const struct GNUNET_MessageHeader *msg)
Parse msg.
Definition: hello-uri.c:471
void GNUNET_HELLO_builder_free(struct GNUNET_HELLO_Builder *builder)
Release resources of a builder.
Definition: hello-uri.c:453
char * GNUNET_HELLO_parser_to_url(const struct GNUNET_HELLO_Parser *parser)
Generate GNUnet HELLO URI from a parser.
Definition: hello-uri.c:940
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:1223
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_new(const struct GNUNET_PeerIdentity *pid)
Allocate builder.
Definition: hello-uri.c:401
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:1060
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:1201
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:1103
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:1177
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:619
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_to_block(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, void *block, size_t *block_size, struct GNUNET_TIME_Relative expiration_time)
Generate DHT block from a builder.
Definition: hello-uri.c:1006
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:412
void(* GNUNET_HELLO_UriCallback)(void *cls, const struct GNUNET_PeerIdentity *pid, const char *uri)
Callback function used to extract URIs from a builder.
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:646
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_url(const char *url)
Parse GNUnet HELLO url.
Definition: hello-uri.c:682
char * GNUNET_HELLO_builder_to_url(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
Generate GNUnet HELLO URI from a builder.
Definition: hello-uri.c:997
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_block(const void *block, size_t block_size)
Parse block.
Definition: hello-uri.c:559
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-ng.c:190
struct GNUNET_MessageHeader * GNUNET_HELLO_builder_to_dht_hello_msg(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time)
Generate DHT HELLO message (without peer ID) from a builder.
Definition: hello-uri.c:822
struct GNUNET_MQ_Envelope * GNUNET_HELLO_builder_to_env(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time)
Generate envelope with GNUnet HELLO message (including peer ID) from a builder.
Definition: hello-uri.c:1168
char * GNUNET_HELLO_builder_to_url2(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time)
Generate GNUnet HELLO URI from a builder.
Definition: hello-uri.c:873
GNUNET_GenericReturnValue
Named constants for return values.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:44
Private ECC key encoded for transmission.
Context for building (or parsing) HELLO URIs.
Definition: hello-uri.c:205
Context for parsing HELLOs.
Definition: hello-uri.c:258
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.
Time for relative time used by GNUnet, in microseconds.