GNUnet  0.17.6
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 
111 bool
113  const struct GNUNET_DATACACHE_Block *bd,
114  const struct GNUNET_HashCode *query_hash,
115  unsigned int get_path_length,
116  const struct GNUNET_DHT_PathElement *get_path);
117 
118 
131  const struct GNUNET_CONTAINER_BloomFilter *bloom);
132 
133 
141 void
142 GDS_try_connect (void *cls,
143  const char *uri);
144 
145 
157 void
158 GDS_u_connect (void *cls,
159  struct GNUNET_DHTU_Target *target,
160  const struct GNUNET_PeerIdentity *pid,
161  void **ctx);
162 
163 
170 void
171 GDS_u_disconnect (void *ctx);
172 
173 
184 void
185 GDS_u_receive (void *cls,
186  void **tctx,
187  void **sctx,
188  const void *message,
189  size_t message_size);
190 
191 
197 void
199 
200 
207 GDS_NEIGHBOURS_init (void);
208 
209 
213 void
214 GDS_NEIGHBOURS_done (void);
215 
216 
222 struct GNUNET_PeerIdentity *
223 GDS_NEIGHBOURS_get_id (void);
224 
225 
226 #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.
Definition: gnunet_common.h:96
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