GNUnet  0.20.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
39 extern "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 
54 
58 #define GNUNET_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply ( \
59  GNUNET_TIME_UNIT_DAYS, 2)
60 
61 
68 struct GNUNET_HELLO_Builder *
70 
71 
77 void
79 
80 
87 struct GNUNET_HELLO_Builder *
89 
90 
98 struct GNUNET_HELLO_Builder *
99 GNUNET_HELLO_builder_from_block (const void *block,
100  size_t block_size);
101 
102 
109 struct GNUNET_HELLO_Builder *
110 GNUNET_HELLO_builder_from_url (const char *url);
111 
112 
121 struct GNUNET_MQ_Envelope *
123  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
124 
125 
133 struct GNUNET_MessageHeader *
135  const struct GNUNET_HELLO_Builder *builder,
136  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
137 
138 
146 char *
148  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
149 
163  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
164  void *block,
165  size_t *block_size);
166 
167 
178  const char *address);
179 
180 
191  const char *address);
192 
193 
200 typedef void
201 (*GNUNET_HELLO_UriCallback) (void *cls,
202  const char *uri);
203 
204 
213 void
215  struct GNUNET_PeerIdentity *pid,
217  void *uc_cls);
218 
219 
234  const struct GNUNET_PeerIdentity *pid,
235  void **block,
236  size_t *block_size,
237  struct GNUNET_TIME_Absolute *block_expiration);
238 
239 
240 #if 0 /* keep Emacsens' auto-indent happy */
241 {
242 #endif
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 /* ifndef GNUNET_HELLO_URI_LIB_H */
248 #endif
249  /* end of group */
251  /* end of group addition */
253 
254 /* 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_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
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_block(const void *block, size_t block_size)
Parse block into builder.
Definition: hello-uri.c:360
void GNUNET_HELLO_builder_free(struct GNUNET_HELLO_Builder *builder)
Release resources of a builder.
Definition: hello-uri.c:319
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:844
struct GNUNET_MessageHeader * GNUNET_HELLO_builder_to_dht_hello_msg(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
Generate DHT HELLO message (without peer ID) from a builder.
Definition: hello-uri.c:586
void GNUNET_HELLO_builder_iterate(const struct GNUNET_HELLO_Builder *builder, struct GNUNET_PeerIdentity *pid, GNUNET_HELLO_UriCallback uc, void *uc_cls)
Iterate over URIs in a builder.
Definition: hello-uri.c:822
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:798
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_from_msg(const struct GNUNET_MessageHeader *msg)
Parse msg into builder.
Definition: hello-uri.c:337
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:748
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)
Generate DHT block from a builder.
Definition: hello-uri.c:699
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_new(const struct GNUNET_PeerIdentity *pid)
Allocate builder.
Definition: hello-uri.c:308
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_from_url(const char *url)
Parse GNUnet HELLO url into builder.
Definition: hello-uri.c:416
void(* GNUNET_HELLO_UriCallback)(void *cls, const char *uri)
Callback function used to extract URIs from a builder.
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:634
struct GNUNET_MQ_Envelope * GNUNET_HELLO_builder_to_env(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
Generate envelope with GNUnet HELLO message (including peer ID) from a builder.
Definition: hello-uri.c:554
GNUNET_GenericReturnValue
Named constants for return values.
Private ECC key encoded for transmission.
Context for building (or parsing) HELLO URIs.
Definition: hello-uri.c:184
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.