GNUnet  0.20.0
gnunet-service-dht_neighbours.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2009, 2010, 2011, 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 
27 #ifndef GNUNET_SERVICE_DHT_NEIGHBOURS_H
28 #define GNUNET_SERVICE_DHT_NEIGHBOURS_H
29 
30 #include "gnunet_util_lib.h"
31 #include "gnunet_block_lib.h"
32 #include "gnunet_dht_service.h"
33 #include "gnunet_dhtu_plugin.h"
35 
36 
37 struct PeerInfo;
38 
45 struct PeerInfo *
46 GDS_NEIGHBOURS_lookup_peer (const struct GNUNET_PeerIdentity *target);
47 
48 
64  uint16_t desired_replication_level,
65  uint16_t hop_count,
66  struct GNUNET_CONTAINER_BloomFilter *bf);
67 
68 
89  uint16_t desired_replication_level,
90  uint16_t hop_count,
91  const struct GNUNET_HashCode *key,
92  const void *xquery,
93  size_t xquery_size,
94  struct GNUNET_BLOCK_Group *bg,
95  struct GNUNET_CONTAINER_BloomFilter *peer_bf);
96 
97 
110 bool
112  const struct GNUNET_DATACACHE_Block *bd,
113  const struct GNUNET_HashCode *query_hash,
114  unsigned int get_path_length,
115  const struct GNUNET_DHT_PathElement *get_path);
116 
117 
130  const struct GNUNET_CONTAINER_BloomFilter *bloom);
131 
132 
140 void
141 GDS_try_connect (void *cls,
142  const char *uri);
143 
144 
156 void
157 GDS_u_connect (void *cls,
158  struct GNUNET_DHTU_Target *target,
159  const struct GNUNET_PeerIdentity *pid,
160  void **ctx);
161 
162 
169 void
170 GDS_u_disconnect (void *ctx);
171 
172 
182 void
183 GDS_u_receive (void *cls,
184  void **tctx,
185  void **sctx,
186  const void *message,
187  size_t message_size);
188 
189 
195 void
197 
198 
205 GDS_NEIGHBOURS_init (void);
206 
207 
211 void
212 GDS_NEIGHBOURS_done (void);
213 
214 
220 struct GNUNET_PeerIdentity *
221 GDS_NEIGHBOURS_get_id (void);
222 
223 
224 #endif
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
static struct GNUNET_PEERINFO_Handle * pi
Handle to peerinfo service.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
GNUnet DHT service's datacache integration.
bool GDS_NEIGHBOURS_handle_reply(struct PeerInfo *pi, const struct GNUNET_DATACACHE_Block *bd, const struct GNUNET_HashCode *query_hash, unsigned int get_path_length, const struct GNUNET_DHT_PathElement *get_path)
Handle a reply (route to origin).
enum GNUNET_GenericReturnValue GDS_NEIGHBOURS_handle_put(const struct GNUNET_DATACACHE_Block *bd, uint16_t desired_replication_level, uint16_t hop_count, struct GNUNET_CONTAINER_BloomFilter *bf)
Perform a PUT operation.
enum GNUNET_GenericReturnValue GDS_NEIGHBOURS_init(void)
Initialize neighbours subsystem.
void GDS_u_disconnect(void *ctx)
Function to call when we disconnected from a peer and can henceforth cannot transmit to that peer any...
void GDS_NEIGHBOURS_broadcast(const struct GNUNET_MessageHeader *msg)
Send msg to all peers in our buckets.
void GDS_try_connect(void *cls, const char *uri)
Callback function used to extract URIs from a builder.
void GDS_u_connect(void *cls, struct GNUNET_DHTU_Target *target, const struct GNUNET_PeerIdentity *pid, void **ctx)
Function to call when we connect to a peer and can henceforth transmit to that peer.
void GDS_NEIGHBOURS_done(void)
Shutdown neighbours subsystem.
enum GNUNET_GenericReturnValue GDS_am_closest_peer(const struct GNUNET_HashCode *key, const struct GNUNET_CONTAINER_BloomFilter *bloom)
Check whether my identity is closer than any known peers.
struct GNUNET_PeerIdentity * GDS_NEIGHBOURS_get_id(void)
Get the ID of the local node.
void GDS_u_receive(void *cls, void **tctx, void **sctx, const void *message, size_t message_size)
Function to call when we receive a message.
enum GNUNET_GenericReturnValue GDS_NEIGHBOURS_handle_get(enum GNUNET_BLOCK_Type type, enum GNUNET_DHT_RouteOption options, uint16_t desired_replication_level, uint16_t hop_count, const struct GNUNET_HashCode *key, const void *xquery, size_t xquery_size, struct GNUNET_BLOCK_Group *bg, struct GNUNET_CONTAINER_BloomFilter *peer_bf)
Perform a GET operation.
struct PeerInfo * GDS_NEIGHBOURS_lookup_peer(const struct GNUNET_PeerIdentity *target)
Lookup peer by peer's identity.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
Library for data block manipulation.
API to the DHT service.
GNUNET_DHT_RouteOption
Options for routing.
GNUNET_GenericReturnValue
Named constants for return values.
Block group data.
Information about a block stored in the datacache.
Opaque handle that the underlay offers for the target peer when sending messages to another peer.
A (signed) path tracking a block's flow through the DHT is represented by an array of path elements,...
A 512-bit hashcode.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Entry for a peer in a bucket.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model