GNUnet 0.26.2-114-g7c6b613e3
 
Loading...
Searching...
No Matches
dht_helper.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2024, 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
21#ifndef GDS_DHT_HELPER_H
22#define GDS_DHT_HELPER_H
23
29#include "dht.h"
30#include "gnunet_common.h"
31#include "gnunet_dht_service.h"
32#include "gnunet_pils_service.h"
33#include "gnunet_time_lib.h"
34#include "gnunet_util_lib.h"
35
36
40extern struct GNUNET_PILS_Handle *GDS_pils;
41
42
43typedef bool (* GDS_HelperCallback) (void *cls,
44 const struct GNUNET_CRYPTO_EddsaSignature *
45 sig);
46
47typedef bool (* GDS_HelperMsgCallback) (void *cls,
48 size_t msize,
49 struct PeerPutMessage *ppm);
50
52
53
54void
56
57
59GDS_helper_put_message_get_size (size_t *msize_out,
60 const struct GNUNET_PeerIdentity *my_identity,
61 enum GNUNET_DHT_RouteOption ro_in,
62 enum GNUNET_DHT_RouteOption *ro_out,
64 block_expiration_time,
65 const uint8_t *block_data,
66 size_t block_data_len,
67 const struct GNUNET_DHT_PathElement *
68 put_path_in,
69 unsigned int put_path_len_in,
70 unsigned int *put_path_len_out,
71 const struct GNUNET_PeerIdentity *trunc_origin,
72 struct GNUNET_PeerIdentity *trunc_peer_out,
73 bool *truncated);
74
75
88bool
89GDS_helper_sign_path (const void *data,
90 size_t data_size,
91 const struct GNUNET_CRYPTO_EddsaPrivateKey *sk,
92 struct GNUNET_TIME_Absolute exp_time,
93 const struct GNUNET_PeerIdentity *pred,
94 const struct GNUNET_PeerIdentity *succ,
96 size_t cb_data_size,
97 void *cb_data);
98
99bool
101 size_t msize,
102 const struct GNUNET_CRYPTO_EddsaPrivateKey *sk,
103 const struct GNUNET_PeerIdentity *target,
104 const struct GNUNET_HashCode *target_hash,
105 const struct GNUNET_CONTAINER_BloomFilter *bf,
106 const struct GNUNET_HashCode *block_key,
109 struct GNUNET_TIME_Absolute block_expiration_time,
110 const uint8_t *block_data,
111 size_t block_data_len,
112 const struct GNUNET_DHT_PathElement *put_path,
113 unsigned int put_path_len,
114 size_t hop_count,
115 uint32_t desired_replication_level,
116 const struct GNUNET_PeerIdentity *trunc_peer,
118 size_t cb_data_size,
119 void *cb_data);
120
121#endif
enum GNUNET_GenericReturnValue GDS_helper_put_message_get_size(size_t *msize_out, const struct GNUNET_PeerIdentity *my_identity, enum GNUNET_DHT_RouteOption ro_in, enum GNUNET_DHT_RouteOption *ro_out, struct GNUNET_TIME_Absolute block_expiration_time, const uint8_t *block_data, size_t block_data_len, const struct GNUNET_DHT_PathElement *put_path_in, unsigned int put_path_len_in, unsigned int *put_path_len_out, const struct GNUNET_PeerIdentity *trunc_origin, struct GNUNET_PeerIdentity *trunc_peer_out, bool *truncated)
Definition dht_helper.c:96
bool GDS_helper_make_put_message(struct PeerPutMessage *ppm, size_t msize, const struct GNUNET_CRYPTO_EddsaPrivateKey *sk, const struct GNUNET_PeerIdentity *target, const struct GNUNET_HashCode *target_hash, const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *block_key, enum GNUNET_DHT_RouteOption ro, enum GNUNET_BLOCK_Type block_type, struct GNUNET_TIME_Absolute block_expiration_time, const uint8_t *block_data, size_t block_data_len, const struct GNUNET_DHT_PathElement *put_path, unsigned int put_path_len, size_t hop_count, uint32_t desired_replication_level, const struct GNUNET_PeerIdentity *trunc_peer, GDS_HelperMsgCallback cb, size_t cb_data_size, void *cb_data)
Definition dht_helper.c:326
struct GNUNET_PILS_Handle * GDS_pils
Handle for the pils service.
bool GDS_helper_sign_path(const void *data, size_t data_size, const struct GNUNET_CRYPTO_EddsaPrivateKey *sk, struct GNUNET_TIME_Absolute exp_time, const struct GNUNET_PeerIdentity *pred, const struct GNUNET_PeerIdentity *succ, GDS_HelperCallback cb, size_t cb_data_size, void *cb_data)
Sign that we are routing a message from pred to succ.
Definition dht_helper.c:226
bool(* GDS_HelperMsgCallback)(void *cls, size_t msize, struct PeerPutMessage *ppm)
Definition dht_helper.h:47
void GDS_helper_cleanup_operations(void)
Definition dht_helper.c:81
bool(* GDS_HelperCallback)(void *cls, const struct GNUNET_CRYPTO_EddsaSignature *sig)
Definition dht_helper.h:43
static unsigned int block_type
The type of the query.
static char * data
The data to insert into the dht.
static size_t data_size
Number of bytes in data.
static struct GNUNET_PeerIdentity my_identity
Identity of this peer.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
API to the DHT service.
Functions related to time.
GNUNET_DHT_RouteOption
Options for routing.
GNUNET_GenericReturnValue
Named constants for return values.
GDS_HelperCallback cb
Definition dht_helper.c:45
Private ECC key encoded for transmission.
an ECC signature using EdDSA.
A (signed) path tracking a block's flow through the DHT is represented by an array of path elements,...
A 512-bit hashcode.
A handle for the PILS service.
Definition pils_api.c:82
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
P2P PUT message.
Definition dht.h:429